Improve logging modules and listing #984

All logging modules log to stderr
This commit is contained in:
Greg Wilkins 2016-10-20 10:57:17 +11:00
parent f9be11bcc2
commit d7b781574d
6 changed files with 52 additions and 36 deletions

View File

@ -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:
# <level>: <log message> [<date/time>]
#
# 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

View File

@ -2,7 +2,14 @@
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="RollingFile" class="org.apache.log4j.RollingFileAppender">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
</layout>
</appender>
<!--
<appender name="file" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${jetty.logging.dir}/jetty.log" />
<param name="MaxFileSize" value="100MB" />
<param name="MaxBackupIndex" value="10" />
@ -10,9 +17,12 @@
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
</layout>
</appender>
-->
<root>
<priority value ="info" />
<appender-ref ref="RollingFile" />
<level value="INFO" />
<appender-ref ref="console" />
<!--<appender-ref ref="file" />-->
</root>
</log4j:configuration>

View File

@ -1,7 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn" name="Jetty" >
<Appenders>
<RollingFile name="RollingFile"
</Appenders>
<Loggers>
<Root level="error">
<AppenderRef ref="STDOUT"/>
</Root>
</Loggers>
<Appenders>
<Console name="console" target="SYSTEM_ERR">
<PatternLayout pattern="%m%n"/>
</Console>
<!--
<RollingFile name="file"
fileName="${jetty.logging.dir}/jetty.log"
filePattern="${jetty.logging.dir}/jetty-%d{MM-dd-yyyy}.log.gz"
ignoreExceptions="false">
@ -11,11 +25,14 @@
<SizeBasedTriggeringPolicy size="10MB"/>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
-->
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="RollingFile"/>
<AppenderRef ref="console"/>
</Root>
</Loggers>
</Configuration>

View File

@ -1,10 +1,18 @@
<configuration>
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/>
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${jetty.logging.dir}/jetty.log</file>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern>
</encoder>
</appender>
<!--
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/jetty.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>logs/jetty-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>100MB</maxFileSize>
<maxHistory>10</maxHistory>
@ -14,9 +22,10 @@
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
-->
<root level="INFO">
<appender-ref ref="ROLLING" />
<appender-ref ref="console" />
</root>
</configuration>

View File

@ -7,7 +7,6 @@ logging
[depends]
resources
console-capture
[provides]
logging

View File

@ -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