Removing Tomcat logging

2010-04-21
QueueMetrics keeps a detailed log of all transactions performed, in order to be able to find which transactions are slow and for forensic analysis (you can never know...). They may end up taking substantial disk space.

First, you may want to rotate Tomcat logs using a logrotate job like the following one:
/usr/local/queuemetrics/tomcat/logs/*.* {
  missingok
  rotate 5
  daily
  compress
  create 0640 root root
  postrotate
      /etc/init.d/queuemetrics restart > /dev/null 2> /dev/null
  endscript
}

If you want to turn off logging entirely, edit the server.xml file and remove sections:
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true"/>

and:
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>



Then edit catalina.sh and remove all logging to
"$CATALINA_BASE"/logs/catalina.out 2>&1
by entering:
/dev/null 2>&1
For more information on Tomcat logging, see http://wiki.apache.org/tomcat/FAQ/Logging

Thanks to PSN for input!

Permalink - Back to FAQs

QueueMetrics Training