简体   繁体   中英

What is the difference between ‘catalina.out’ and ‘catalina.YYYY-MM-DD.log’ log files in tomcat webapp server?

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.

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.

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");

catalina.out Starts when tomcat instance is installed and started. Has logs from beginning to forever.

catalina.YYYY-MM-DD.log This is the same log as in catalina.out, but split into daily logs.

You can delete catalina.out log periodically, you'll have the same logs in your daily log file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM