Introduction to Tomcat 🗃️Logging

Introduction to Tomcat 🗃️Logging

Upon starting Apache Tomcat will create several log files in the tomcat/logs directory. In this article, we’ll focus on the default and most common logging implementation used for Tomcat – the included JULI implementation.

Tomcat logging settings

The default log files and logging levels are defined in /conf/logging.properties

Tomcat logging settings
logging.properties

As of Tomcat 5.5, Tomcat uses an implementation of the Apache Commons Logging library based on the java.util.logging(JULI) framework.

JULI is implemented in $CATALINA_HOME/bin/tomcat-juli.jar.

Here’s a look at all the layers at which JULI’s logging can be configured, including both layers standard to java.util.logging and JULI’s per-classloader layers:

  • logging.properties – self explanatory and located in your $JAVA_HOME/jre/lib directory
  • java.util.logging.config.class – which is used for programmatic configuration
  • logging.properties – located within each classloader you wish to configure.

Simple examples of the logging.properties file for both Tomcat’s core and per-web application configurations are provided on Apache’s Tomcat Documentation site.

Where are Tomcat log files

Log files are written to the /logs directory of a running instance ($CATALINA_BASE/logs).

Where are Tomcat log files
Tomcat logs directory

Tomcat log files

The default log files for every Tomcat instance are:

  • catalina.log – a log with entries that describe server activity
  • catalina.out – a log for system output and standard error messages
  • localhost.log – a log file for tracking Web application activity
  • localhost_access.log – a log for tracking requests processed by the server
  • host_manager.log – a log for Tomcat’s host-manager.war Web application
  • manager.log – a log for Tomcat’s manager.war Web application
See also  The Benefits of Using Linux over Windows
localhost_access.log
localhost_access.log

Tomcat logging levels

The following is a list of the JULI logging levels that apply to Tomcat.

LevelLog content
SEVERESerious failures
WARNINGPotential problems
INFOInformational messages
CONFIGStatic configuration messages
FINETrace messages
FINERDetailed trace messages
FINESTHighly detailed trace messages

The list is arranged in order by level of detail from the least (SEVERE) to the greatest (FINEST). Note that a level includes all the content of previous levels.

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.