Jul 18

The default logging configuration that ships with Tomcat 6.0 logs to both catalina.out and also a daily log catalina.yyyy-mm-dd.log. The daily log starts a new file everyday, but catalina.out just continues to grow until your disk fills up.

To make things worse if you want to purge catalina.out you need to restart tomcat to free up the disk space used as tomcat holds the file open.

To avoid this situation what you can do is remove the logging to catalina.out (by removing the handler). This can be achieved by editting conf/logging.properties and changing:

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

to

.handlers = 1catalina.org.apache.juli.FileHandler

written by objects \\ tags: , ,


2 Responses to “How to stop logging to catalina.out with Tomcat 6.0”

  1. Matthew Says:

    What if it is the catalina.yyyy-mm-dd.log that we wish to stop? logrotate seems t handle the catalina.out file just fine. Would we just delete the 1catalina.org.apache.juli.FileHandler?

  2. CT Says:

    What was said about the catalina.out growing after deletion and requiring a restart of tomcat can be avoided if a copy/truncate (or just truncate) is performed on catalina.out. This purges the contents of the log while leaving the file handle/descriptor connected to the file name on disk, thus not interrupting the open file handle used by the tomcat logging process.

    Removing all the handlers should disable logging, but you should still have some kind of log there in case of issues (always nice to be able to debug a problem), just turn down the amount of data you’re logging from the admin console (change the log level to WARN or SEVERE for all categories) and use logrotated to compress and discard old logfiles as normal.

Leave a Reply

You must be logged in to post a comment.