FreeKB - How to configure logging in Tomcat
How to configure logging in Tomcat

Home > Search > How-to

Catalina / Localhost / Manager logs

The ${catalina.base}/conf/ file controls how Tomcat handles logging globally. Following is an excerpt of a file. This file specifies the directory where log files will reside, and the log file prefix, such as catalina, localhost, and manager.

By default, the log level is set to FINE. The log levels that can be used are SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST or ALL. = FINE = ${catalina.base}/logs = catalina. = FINE = ${catalina.base}/logs = localhost. = FINE = ${catalina.base}/logs = manager. = 16384

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

access logs

The $CATALINA_HOME/conf/server.xml file controls how events are written to the access log. By default, the server.xml file should have something similar to the following.

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
       prefix="localhost_access_log" suffix=".txt"
       pattern="%h %l %u %t &quot;%r&quot; %s %b" />


The above will create log files in the $CATALINA_HOME/logs/ directory. The log files will be named

Let's use a scenario where the Tomcat server has IP address and a client with IP address navigates to http://tomcat_hostname:8080 to get the Tomcat web interface. This will write the following events in the access log. The access log contains the IP address of the remote machine, the date and time a request was requested, the resource that was requested, and the status code. - - [07/Jul/2017:10:07:47 -0500] "GET / HTTP/1.1" 200 11256 - - [07/Jul/2017:10:07:47 -0500] "GET /tomcat.css HTTP/1.1" 200 5581 - - [07/Jul/2017:10:07:47 -0500] "GET /tomcat.png HTTP/1.1" 304 - - - [07/Jul/2017:10:07:47 -0500] "GET /bg-nav.png HTTP/1.1" 304 - - - [07/Jul/2017:10:07:47 -0500] "GET /asf-logo-wide.svg HTTP/1.1" 304 - - - [07/Jul/2017:10:07:47 -0500] "GET /bg-upper.png HTTP/1.1" 304 - - - [07/Jul/2017:10:07:47 -0500] "GET /bg-middle.png HTTP/1.1" 304 - - - [07/Jul/2017:10:07:47 -0500] "GET /bg-button.png HTTP/1.1" 304 - - - [07/Jul/2017:10:07:47 -0500] "GET /favicon.ico HTTP/1.1" 200 21630


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.