0

I have a question regarding tomcat in version 8.0. I have a fast growing catalina.out log file.

Where can I find the setting so that the log only grows to a certain size or maybe I can disable logging into catalina.out at all?

  • `catalina.out` can grow from both logging statements and code that calls `System.out`. Have you looked at both to determine where the excessive logging is originating? Additionally, what is your operating system? – stdunbar Jul 05 '18 at 16:56
  • For log rotation see the SO question [How to rotate the tomcat localhost log?](https://stackoverflow.com/questions/6278614/how-to-rotate-the-tomcat-localhost-log) though it is a fairly old post. And https://dzone.com/articles/how-rotate-tomcat-catalinaout describes how to do size based log rotation on Linux. Are you using Linux or Windows? – skomisa Jul 05 '18 at 20:46

1 Answers1

0

I don't recommend disabling logging into catalina.out since you it will not help you in terms of debugging etc.

Therefore, this could be used to clear the log of catalina.out file without stopping tomcat with the command below.

sudo cat /dev/null > /opt/tomcat/apache-tomcat-9.0.37/logs/catalina.out  

To keep catalina.out smaller in size, either one of the following ways can be used:

  1. You could use the above Linux command and add it to a CronScheduler to run daily/ weekly/ monthly or yearly as preferred.

  2. Use logrotate tool in Linux. It is a log managing command-line tool in Linux. This can rotate the log files under different conditions. Particularly, we can rotate log files on a fixed duration or if the file has grown to a certain size. You can click here for more info on this.

Du-Lacoste
  • 11,530
  • 2
  • 71
  • 51