Search code examples
javaapachetomcat7

Tomcat logging configuration


I am using Tomcat 7 / 8 in cloud, in panel log viewer got below log files: Log files

  1. Catalina.out
  2. instance.log
  3. access log

And i found official document from tomcat, but still confused. https://tomcat.apache.org/tomcat-7.0-doc/logging.html

I cannot access such folder like /apache/apache-tomcat-8.0.15/logs Can explain the usage for each log file with sample words?


Solution

  • In simple words:

    1. Catalina.out - Some app logs and system specific logs

    2. instance.log - Application specific logs

    3. access log - Contains the app paths that were accessed (the users' Web requests)

    More details / bg:

    1. Catalina.out : "When running Tomcat on unixes, the console output is usually redirected to the file named catalina.out", so your System.out.println, logger.info, or exception should be found in it.

    2. instance.log : the log related to application running status / life cycle.

    3. There are two main approaches to configure Tomcat logs:

      a. The java.util.logging (JUL) API

      found at ${catalina.base}/conf/logging.properties

      b. Apache log4j

      found at $CATALINA_BASE/lib/log4j.properties. Don't confuse this with application's logs.

    log4j.jar and log4j.properties go into WEB-INF/lib and WEB-INF/classes, respectively, in your web application.