5

In a tomcat server, logs folder contains files like these

  • localhost.YYYY-MM-DD.log: the log of the host
  • host-manager.YYYY-MM-DD.log and manager.YYYY-MM-DD.log: the logs of the related web applications
  • catalina.YYYY-MM-DD.log:: the container log file
  • catalina.out: ??

I have an understanding about all the log files other than "catalina.out". I was looking for an explanation in the documentation but couldn't find different between "catalina.out" and "catalina.YYYY-MM-DD.log". When I go through the content, both seem similar. Can someone please help me to differentiate them?

Note: Reason I'm digging into this is my productions servers, "catalina.out" file is becoming bulkier(around 12 GB now). This can crash my application at any time since tomcat will not guarantee for application crashes after "catalina.out" become more than 2gb (as the Tomcat reference). Remaining options are rotating "catalina.out" using 3rd party tool like Logrotate or clean the "catalina.out". I'm using sl4j with log4j as the logging toolkit.

Chamin Wickramarathna
  • 1,672
  • 2
  • 20
  • 34
  • Seems like System.out and System.err are redirected to catalina.out. Not all the loggings. catalina.out used to store console outputs. – Chamin Wickramarathna Aug 23 '18 at 12:53
  • catalina.out is the current log. catalina.yyy-mm-dd.log is the previous/rotated log – AlexC Aug 23 '18 at 12:57
  • As I saw both of them contain similar content. Catalina.out contains almost everything in the log including something more. – Chamin Wickramarathna Aug 28 '18 at 09:19
  • It might be useful to post the config files, the tomcat version of the log4j in conf and also your applications config of log4j usually in root of your webapp's classpath. One of those may be configured with an appender that is putting things into catalina.out and not into the rotating one. You may also consider reducing the logging level if that's a reason for so much output. – AlexC Aug 28 '18 at 11:35
  • Related: https://serverfault.com/questions/476647/why-does-tomcat7-log-into-both-catalina-out-and-catalina-yyyy-mm-dd-log – StackzOfZtuff May 22 '23 at 07:14

2 Answers2

3

According to tomcat documentation catalina.out contains all output, that goes to System.err/out (it is, generally, a console log)

All other logging is done by application (by default, using juli framework, but log4j is popular too). See configuration file examples in the link above - it contains log file name prefixes like catalina. localhost. manager. - this is the source of catalina.log
Also see here for possible logging and log rotation parameters. (might prove useful)

What that means, is: Application logging and log rotation is managed by logging framework (juli,log4j..) and everything that escapes it (tomcat startup/shutdown, uncaught exceptions, logging which is done both to a handler and to console) goes to catalina.out
Since console is "above" tomcat and all its loggers, there is no way to rotate catalina.out internally in tomcat.

Rimantas
  • 31
  • 6
2
private static final Logger log = LoggerFactory.getLogger(Foo.class);
...
log.info("This line will go to Catalina.YYYY-MM-DD.log");
System.out.println("This line will go to Catalina.out");
StackzOfZtuff
  • 2,534
  • 1
  • 28
  • 25
izy
  • 1,085
  • 14
  • 18