How to turn off all tomcat log rotation

You're probably using JULI logging as the default in your tomcat instance. Try this

1catalina.org.apache.juli.FileHandler.rotatable = false

In logging.properties.

There are some samples online if you search for that property.

If you're not using those logs for anything, you can just remove or rename off the logging.properties file to stop using JULI logging.


I think you're coming to it from the wrong perspective. There is nothing inherently novel about logrotate, in fact, it usually gets run from cron once a day, which can result in funny situations where you have no idea why your logrotate directions aren't working.

The best approach here may be to leave the defaults of tomcat as-is (which, in fact, are more friendly for various backup purposes, for example), and do the rotation with a simple script that uses file modification time to perform the rotation (e.g., find /var/tomcat/logs/ -mtime +5 -name "*.log" -exec echo rm {} \;, remove echo for the real thing).

Per related question, you can also configure the above find snippet within the lastaction / endscript directives of logrotate, or, better yet, put it directly into cron to run on your own time.

Other references:

  • Why does tomcat7 log into both catalina.out and catalina.YYYY-MM-DD.log?

  • https://stackoverflow.com/questions/15183321/whats-the-easiest-way-to-rotate-nginx-log-files-monthly/15183322#15183322