[logback-user] Time and Size Based Rolling Not Working
Noman Amir Jamil
n.amir.jamil at gmail.com
Sat Dec 31 14:34:42 CET 2011
Hi,
I have recently switched to logback for tomcat6 logging. I was able to
successfully set it up and log files are being created and logged into.
Following is my logback.xml:
=================
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="CONSOLE"
class="org.apache.juli.logging.ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level {%thread} [%logger{20}] :
%msg%n</pattern>
</encoder>
</appender>
<appender name="FILE-CATALINA"
class="org.apache.juli.logging.ch.qos.logback.core.rolling.RollingFileAppender">
<file>${catalina.base}/logs/catalina.log</file>
<append>true</append>
<encoder>
<charset>utf-8</charset>
<pattern>%d{HH:mm:ss.SSS} %-5level {%thread} [%logger{40}] :
%msg%n</pattern>
</encoder>
<rollingPolicy
class="org.apache.juli.logging.ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${catalina.base}/logs/catalina-%d{yyyyMMdd}-%i.log.zip</fileNamePattern>
<maxHistory>60<!-- days --></maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class="org.apache.juli.logging.ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10KB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
<appender name="FILE-LOCALHOST"
class="org.apache.juli.logging.ch.qos.logback.core.rolling.RollingFileAppender">
<file>${catalina.base}/logs/localhost.log</file>
<append>true</append>
<encoder>
<charset>utf-8</charset>
<pattern>%d{HH:mm:ss.SSS} %logger{0} {%thread} %level : %msg%n</pattern>
</encoder>
<rollingPolicy
class="org.apache.juli.logging.ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${catalina.base}/logs/localhost-%d{yyyyMMdd}-%i.log.zip</fileNamePattern>
<maxHistory>60<!-- days --></maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class="org.apache.juli.logging.ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10KB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
<logger name="org.apache.catalina" level="INFO" additivity="false">
<appender-ref ref="FILE-CATALINA" />
</logger>
<logger
name="org.apache.catalina.core.ContainerBase.[Catalina].[localhost]"
level="INFO" additivity="false">
<appender-ref ref="FILE-LOCALHOST" />
</logger>
<root level="INFO">
<appender-ref ref="CONSOLE" />
</root>
</configuration>
=================
The logback jars being used are of version logback-0.9.30 as higher version
doesn't work with tomcat6.
The issue is that log files for localhost appender are being rolled over,
but the catalina logs are not rolled over even after reaching the specified
limit, unless I restart tomcat.
The tomcat6 is running on Windows Server 2008.
Can anybody help me with this?
Thanks
Noman A.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20111231/7388e906/attachment.html>
More information about the Logback-user
mailing list