Search This Blog

Wednesday 4 November 2009

log swallowing on Tomcat

In order to split the catalina.out across multiple files, each one of which created every day, it's useful to configure the context xml descriptor as below (tested on Tomcat 5.0.28)
/usr/local/tomcat/conf/Catalina/localhost/myApp.xml

<context path="/myWebApp" swallowOutput="true">
<logger directory="logs"
      className="org.apache.catalina.logger.FileLogger"
      prefix="myApp_log."
      suffix=".txt"
      timestamp="true"/>
</Context>

which will create every day a new file called
myApp_log.YYYY-MM-DD.txt
containing the daily ouput

This technique is referred to as "output swallowing" on Tomcat
(note the swallowOutput="true")

No comments:

Post a Comment