[logback-user] Tomcat and webapp logging to same file with rollingFileAppender

Roy McMorran mcmorran at mdibl.org
Tue Jun 14 23:23:00 CEST 2011


Greetings,

We're currently using Logback for Tomcat logging via the method 
described at :
https://github.com/grgrzybek/tomcat-slf4j-logback#readme

There are two separate logback.xml files, one for Tomcat logging at 
$CATALINA_HOME/conf and another in the application WEB-INF/classes 
directory. Both use rollingFileAppender with TimeBasedRollingPolicy to 
roll over nightly. Both appenders write to the same file - 
$CATALINA_HOME/logs/tomcat.log . The contents of the logback.xml files 
can be viewed at
http://pastebin.com/UHzy4AZe
and
http://pastebin.com/pEQAga4r

This seems to work well until it is time for the log to roll over. After 
midnight the tomcat.log file is renamed to tomcat.yyyy-MM-dd.log as 
expected. Tomcat begins logging to a new tomcat.log file, as expected. 
However, the application is now logging to the tomcat.yyyy-MM-dd.log , 
which is not what we want. The lsof command tells me that the Tomcat 
process (jsvc) still has both files open.

Can anyone suggest where we may have went wrong in the configuration?

Thanks!

PS: Tomcat 6.0.29, logback 0.9.26

-- 

Roy McMorran
Systems Administrator
MDI Biological Laboratory
mcmorran at mdibl.org




More information about the Logback-user mailing list