<div dir="ltr">Hi,<div><br></div><div>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:</div><div><br>
</div><div>=================</div><div><div><?xml version="1.0" encoding="UTF-8"?></div><div><br></div><div><configuration></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><appender name="CONSOLE" class="org.apache.juli.logging.ch.qos.logback.core.ConsoleAppender"></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><encoder></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><pattern>%d{HH:mm:ss.SSS} %-5level {%thread} [%logger{20}] : %msg%n</pattern></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span></encoder></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></appender></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><appender name="FILE-CATALINA" class="org.apache.juli.logging.ch.qos.logback.core.rolling.RollingFileAppender"></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><file>${catalina.base}/logs/catalina.log</file></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><append>true</append></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><encoder></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><charset>utf-8</charset></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><pattern>%d{HH:mm:ss.SSS} %-5level {%thread} [%logger{40}] : %msg%n</pattern></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span></encoder></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><rollingPolicy class="org.apache.juli.logging.ch.qos.logback.core.rolling.TimeBasedRollingPolicy"></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><fileNamePattern>${catalina.base}/logs/catalina-%d{yyyyMMdd}-%i.log.zip</fileNamePattern> </div><div><span class="Apple-tab-span" style="white-space:pre"> </span><maxHistory>60<!-- days --></maxHistory></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><timeBasedFileNamingAndTriggeringPolicy class="org.apache.juli.logging.ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><maxFileSize>10KB</maxFileSize> </div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span></timeBasedFileNamingAndTriggeringPolicy></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></rollingPolicy></div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span></appender></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><appender name="FILE-LOCALHOST" class="org.apache.juli.logging.ch.qos.logback.core.rolling.RollingFileAppender"></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><file>${catalina.base}/logs/localhost.log</file></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><append>true</append></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><encoder></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><charset>utf-8</charset></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><pattern>%d{HH:mm:ss.SSS} %logger{0} {%thread} %level : %msg%n</pattern></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span></encoder></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><rollingPolicy class="org.apache.juli.logging.ch.qos.logback.core.rolling.TimeBasedRollingPolicy"></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><fileNamePattern>${catalina.base}/logs/localhost-%d{yyyyMMdd}-%i.log.zip</fileNamePattern> </div><div><span class="Apple-tab-span" style="white-space:pre"> </span><maxHistory>60<!-- days --></maxHistory></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><timeBasedFileNamingAndTriggeringPolicy class="org.apache.juli.logging.ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><maxFileSize>10KB</maxFileSize> </div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span></timeBasedFileNamingAndTriggeringPolicy></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></rollingPolicy></div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span></appender></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><logger name="org.apache.catalina" level="INFO" additivity="false"></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><appender-ref ref="FILE-CATALINA" /></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></logger></div><div><br>
</div><div><span class="Apple-tab-span" style="white-space:pre"> </span><logger name="org.apache.catalina.core.ContainerBase.[Catalina].[localhost]" level="INFO" additivity="false"></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span><appender-ref ref="FILE-LOCALHOST" /></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></logger></div><div><br>
</div><div><span class="Apple-tab-span" style="white-space:pre"> </span><root level="INFO"></div><div><span class="Apple-tab-span" style="white-space:pre"> </span><appender-ref ref="CONSOLE" /></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span></root></div><div><br></div><div></configuration></div></div><div><br></div><div>=================</div><div><br></div><div>The logback jars being used are of version logback-0.9.30 as higher version doesn't work with tomcat6.</div>
<div>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.</div><div><br></div><div>The tomcat6 is running on Windows Server 2008.</div>
<div><br></div><div>Can anybody help me with this?</div><div>Thanks</div><div>Noman A.</div></div>