From d7b781574df4e82a96a3bb8764614146c6754210 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 20 Oct 2016 10:57:17 +1100 Subject: [PATCH] Improve logging modules and listing #984 All logging modules log to stderr --- .../jul-impl/java-util-logging.properties | 31 ++++--------------- .../src/main/config/modules/log4j/log4j.xml | 16 ++++++++-- .../src/main/config/modules/log4j2/log4j2.xml | 21 +++++++++++-- .../main/config/modules/logback/logback.xml | 17 +++++++--- .../src/main/config/modules/logging-jetty.mod | 1 - .../modules/slf4j/simplelogger.properties | 2 +- 6 files changed, 52 insertions(+), 36 deletions(-) diff --git a/jetty-util/src/main/config/modules/jul-impl/java-util-logging.properties b/jetty-util/src/main/config/modules/jul-impl/java-util-logging.properties index a76a5d81984..867df054acb 100644 --- a/jetty-util/src/main/config/modules/jul-impl/java-util-logging.properties +++ b/jetty-util/src/main/config/modules/jul-impl/java-util-logging.properties @@ -1,31 +1,12 @@ -handlers = java.util.logging.FileHandler - -# Default global logging level. -# This specifies which kinds of events are logged across -# all loggers. For any given facility this global level -# can be overriden by a facility specific level -# Note that the ConsoleHandler also has a separate level -# setting to limit messages printed to the console. .level = INFO -############################################################ -# Handler specific properties. -# Describes specific configuration info for Handlers. -############################################################ - -# default file output is in user's home directory. -java.util.logging.FileHandler.pattern = ${jetty.logging.dir}/jetty%u.log -java.util.logging.FileHandler.limit = 50000 -java.util.logging.FileHandler.count = 1 -java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter - -# Limit the message that are printed on the console to INFO and above. +handlers = java.util.logging.ConsoleHandler java.util.logging.ConsoleHandler.level = INFO java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter -# Example to customize the SimpleFormatter output format -# to print one-line log message like this: -# : [] -# -# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n +#handlers = java.util.logging.FileHandler +#java.util.logging.FileHandler.pattern = ${jetty.logging.dir}/jetty%u.log +#java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter + +java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n diff --git a/jetty-util/src/main/config/modules/log4j/log4j.xml b/jetty-util/src/main/config/modules/log4j/log4j.xml index 57ce0889cf5..5e3d0a9ff95 100644 --- a/jetty-util/src/main/config/modules/log4j/log4j.xml +++ b/jetty-util/src/main/config/modules/log4j/log4j.xml @@ -2,7 +2,14 @@ - + + + + + + + - - + + + + diff --git a/jetty-util/src/main/config/modules/log4j2/log4j2.xml b/jetty-util/src/main/config/modules/log4j2/log4j2.xml index 3721ffca0d2..bc05dad0a6b 100644 --- a/jetty-util/src/main/config/modules/log4j2/log4j2.xml +++ b/jetty-util/src/main/config/modules/log4j2/log4j2.xml @@ -1,7 +1,21 @@ + - + + + + + + + + + + + + + - + + diff --git a/jetty-util/src/main/config/modules/logback/logback.xml b/jetty-util/src/main/config/modules/logback/logback.xml index 4a16147c7b0..552845e3249 100644 --- a/jetty-util/src/main/config/modules/logback/logback.xml +++ b/jetty-util/src/main/config/modules/logback/logback.xml @@ -1,10 +1,18 @@ - - ${jetty.logging.dir}/jetty.log + + + + %-4relative [%thread] %-5level %logger{35} - %msg %n + + + + logs/jetty-%d{yyyy-MM-dd}.%i.log 100MB 10 @@ -14,9 +22,10 @@ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + --> - + diff --git a/jetty-util/src/main/config/modules/logging-jetty.mod b/jetty-util/src/main/config/modules/logging-jetty.mod index f9fcd52227c..39438d7c069 100644 --- a/jetty-util/src/main/config/modules/logging-jetty.mod +++ b/jetty-util/src/main/config/modules/logging-jetty.mod @@ -7,7 +7,6 @@ logging [depends] resources -console-capture [provides] logging diff --git a/jetty-util/src/main/config/modules/slf4j/simplelogger.properties b/jetty-util/src/main/config/modules/slf4j/simplelogger.properties index d7f02258cb6..060cf1cb61e 100644 --- a/jetty-util/src/main/config/modules/slf4j/simplelogger.properties +++ b/jetty-util/src/main/config/modules/slf4j/simplelogger.properties @@ -1,4 +1,4 @@ -org.slf4j.simpleLogger.logFile=logs/jetty.log +#org.slf4j.simpleLogger.logFile=logs/jetty.log org.slf4j.simpleLogger.defaultLogLevel=info org.slf4j.simpleLogger.showDateTime=true org.slf4j.simpleLogger.showThreadName=true