Chapter 19. Logging
Logging is critical for Web applications, as often there is no other way to debug issues on production machines. Also, adding log statements is the only viable option for analyzing the execution of a long-running Web application.
This chapter discusses logging, both internally by Tomcat as well as by Web applications themselves. This chapter covers the following:
A short, tutorial-style introduction to both log4j and Java Logging.
Logging concepts and best practices, such as rolling logs, maintaining information in log messages to be able to identify the source of the error, and much more.
Solutions ("recipes") for common tasks that developers and system administrators need to do while developing effective logging solutions for their applications. Some of these include:
Logging to different destinations, such as a file, system console, or even the system logger (syslog, NT logger)
Being able to notify administrators via e-mail of specific log messages, such as serious errors
The chapter also introduces administrators to tools that they can use to manage the large amount of log data generated.
Changes from Tomcat 5
There are two big changes in logging since Tomcat 5:
Tomcat 6 has done away with the
<Logger>
element defined in theserver.xml
that sent internal Tomcat messages to thelocalhost_log
. Instead, you use the Java Logging property file<CATALINA_HOME>/conf/logging.properties
to configure logging. See the section on JULI for more information on Java Logging configuration ...
Get Professional Apache Tomcat 6 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.