Menu

Apache Tomcat – Logs details

Apache Tomcat Logs: Windows

The main Apache Tomcat configuration file is at C:\Program Files\Apache Software Foundation\Tomcat 9\conf\server.xml.

Once Apache Tomcat starts, it will create several log files in the C:\Program Files\Apache Software Foundation\Tomcat 9\logs directory. The main log file is the catalina.log or catalina.out file where you can find error messages. On some platforms, you may need Admin or root account privileges to view these files.

Log folder is automatically created by tomcat during bootup/startup.

Default logs generated by Tomcat are the following. (in windows), though its almost same for Linux.

Catalina.(date).log
localhost.(date).log
localhost_access_log.(date).log
manager.(date).log
host-manager.(date).log

(Note, in Linux Catalina log is generated as catalina.out)

*****Every log file will have date as suffix to it. We can customise that also.*****

Catalina Log:

19-Sep-2021 09:53:28.358 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.53
19-Sep-2021 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 29 2018 14:42:45 UTC
19-Sep-2021 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.53.0
19-Sep-2021 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
19-Sep-2021 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-862.el7.x86_64
19-Sep-2021 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
19-Sep-2021 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/java/jdk1.8.0_131/jre
19-Sep-2021 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_131-b11
19-Sep-2021 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
19-Sep-2021 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /opt/tomcat
19-Sep-2021 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /opt/tomcat
19-Sep-2021 09:53:28.361 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
19-Sep-2021 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
19-Sep-2021 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
19-Sep-2021 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
19-Sep-2021 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
19-Sep-2021 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/opt/tomcat
19-Sep-2021 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/opt/tomcat
19-Sep-2021 09:53:28.362 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/opt/tomcat/temp

The Catalina log file contains the information which is written onto the console while startup and shutdown is recorded in catalina log.

TIMESTAMP (date & time) [SEVERITY] [SUBSYSTEM] [CLASS RESPONSIBLE] [LOG MESSAGE] [COMMAND]

TIMESTAMP – It contains the time and date for the specific log entry. This is based on the operating system time zone anf format.

SEVERITY – Levels include INFO, WARN, FATAL, ERROR, TRACE, or DEBUG.

SEVERE – Serious failures
WARNING – Potential problems
INFO – Informational messages
CONFIG – Static configuration messages
FINE – Trace messages
FINER – Detailed trace messages
FINEST – Highly detailed trace messages

SUBSYSTEM – This is tomcat’s subsystem or module for that specific log entry. Example [main].

CLASS RESPONSIBLE – The class responsible for the event (org.apache.XXX.XXX).

LOG MESSAGE – Specific action being done.

COMMAND – command executed for this action.

It is good not to modify the values in the log file as it might tamper with the time of the log and provide incorrect information to log analyzers.
***** conf\logging.properties file is responsible for the behaviour of the log format.*****

localhost.YYYY-MM-DD.log

Localhost. {yyyyy-MM-dd}. log is a log that is captured and output by tomcat after unhandled exceptions of application initialization (listener, filter, servlet).
It also contains the running log when tomcat is started and paused, but it does not have the full catalina.2018-09-19.log. It just records some of the logs.

localhost_access_log.YYYY-MM-DD.log

localhost_access_log.2021-09-19.txt: This is the log for accessing tomcat, requesting time and resources, and the status code is recorded.

192.168.1.220 - - [19/Sep/2021:03:57:42 -0400] "GET / HTTP/1.1" 200 11286
192.168.1.220 - - [19/Sep/2021:03:57:42 -0400] "GET /tomcat.css HTTP/1.1" 200 5581
192.168.1.220 - - [19/Sep/2021:03:57:42 -0400] "GET /tomcat.png HTTP/1.1" 200 5103
192.168.1.220 - - [19/Sep/2021:03:57:42 -0400] "GET /bg-button.png HTTP/1.1" 200 713
192.168.1.220 - - [19/Sep/2021:03:57:42 -0400] "GET /bg-nav.png HTTP/1.1" 200 1401
192.168.1.220 - - [19/Sep/2021:03:57:42 -0400] "GET /asf-logo-wide.svg HTTP/1.1" 200 27235
192.168.1.220 - - [19/Sep/2021:03:57:42 -0400] "GET /bg-middle.png HTTP/1.1" 200 1918
192.168.1.220 - - [19/Sep/2021:03:57:42 -0400] "GET /bg-upper.png HTTP/1.1" 200 3103
192.168.1.220 - - [19/Sep/2021:03:58:14 -0400] "GET / HTTP/1.1" 200 11286
192.168.1.220 - - [19/Sep/2021:03:58:14 -0400] "GET /favicon.ico HTTP/1.1" 200 21630
192.168.1.220 - - [19/Sep/2021:03:58:16 -0400] "GET / HTTP/1.1" 200 11286
192.168.1.220 - - [19/Sep/2021:03:58:16 -0400] "GET /favicon.ico HTTP/1.1" 200 21630
192.168.1.220 - - [19/Sep/2021:03:58:21 -0400] "GET / HTTP/1.1" 200 11286
192.168.1.220 - - [19/Sep/2021:03:58:21 -0400] "GET /favicon.ico HTTP/1.1" 200 21630

host-manager.YYYY-MM-DD.log

host-manager.2021-09-19.log: This estimate is the log information of the manager project in tomcat. No important log information is seen.

manager.YYYY-MM-DD.log

manager.2021-09-19.log: This is a log file exclusive to the tomcat manager project.

**Tomcat Log File Cutting

Tomcat’s Catalina.(date).log or catalina.out file, tomcat, is not log-cutting.
When the file is larger than 2G, it will affect the operation of tomcat. So we need to log the file, there are many ways to cut it:

The first is: Cutting is done by logrotate, the cutting tool that comes with the system.

The second is: Cut logs using logj4.

Third: Using cronolog to segment tomcat catalina.out file

Check out another page on my site, for Tomcat Catalina log rotation.

Thanks.

END.

Loading

Categories:   Apache, Linux, Middleware, Tomcat

Comments