This section examines the log files generated by the Tomcat Servlet Container, and the information found in them.
Note:
This section assumes you have successfully installed the JDK and Tomcat Servlet Container as outlined in the Installation of Java and Tomcat section.
Tomcat logs/ Directory
Look at the different types of log files generated in the ${tomcat_home}/logs directory.
Move into the logs/ directory to see the type of information logged (${tomcat_home} is /usr/local in this example):
# cd /usr/local/tomcat/logs
# ls -l
-rw-r----- 1 root root 23451 Oct 24 14:17 catalina.2018-10-24.log
-rw-r----- 1 root root 23451 Oct 24 14:17 catalina.out
-rw-r----- 1 root root 0 Oct 24 13:41 host-manager.2018-10-24.log
-rw-r----- 1 root root 1929 Oct 24 14:17 localhost.2018-10-24.log
-rw-r----- 1 root root 859 Oct 24 13:45 localhost_access_log.2018-10-24.txt
-rw-r----- 1 root root 0 Oct 24 13:41 manager.2018-10-24.log
Question:
Do you see a correspondence between some of the web applications in the Tomcat
webapps/ directory, and the naming of certain log files?
Question:
Is there a difference in the information logged to
catalina.out versus catalina.yyyy-mm-dd.log?
Question:
Are some log files more verbose than others?
Try this exercise
Examining catalina.out.
Open another terminal window (here after referred to as terminal #2) and run the following command in the new terminal:
# tail -f /usr/local/tomcat/logs/catalina.out
In your original terminal window, start/stop and start Tomcat and watch what is being logged to catalina.out in the terminal #2 window.
Question:
Is it only errors messages being reported to
catalina.out?
Things To Know About catalina.out
Note:
The Tomcat Users mailing list has seen a lot of traffic dedicated to
catalina.out logging and rotation.
- Tomcat
System.outandSystem.errgets appended tocatalina.out.catalina.outcan quickly grow large if the hosted web applications are not specifically catching and loggingSystem.outandSystem.errto designated files. catalina.outis not automatically rotated in Tomcat.- You should employ an outside log rotation program (e.g.,
logadmorlogrotate) to rotatecatalina.out. - It is good practice to archive and remove old
catalina.outfiles and other log files out of the${tomcat_home}/logsdirectory on a regular basis.
Note:
On Windows, the
catalina.out file is not automatically created.
Instead, only the catalina.yyyy-mm-dd.log files are used.
These have equivalent content.
Next Step
Next, we’ll examine the Tomcat Configuration Files and how to modify them for use with the TDS.