The Tomcat Logging documentation can be found here.

By default Tomcat logs are handled by java.util.logging. It is possible to modify the Tomcat defaults by providing a file called logging.properties as part as the web application resources.

By default Tomcat logs its output in a file called catalina.out. Such file contains the output from the server itself and from all the web applications that don't specify an alternative output file.

To separate the output from different web applications in different files (making debugging and troubleshooting a much easier) the Tomcat defaults need to be overwritten.

For web applications depending on org-srs-maven-project-war version 2.5 or older, the logging.properties file is automatically created. The output of the web application will be redirected to a file whose name is the same as the web application's name.

The automatically generated file looks like:

handlers = org.apache.juli.FileHandler

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

org.apache.juli.FileHandler.level = FINE
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = APPLICATION_NAME.

Logging Output in Netbeans

By default Netbeans will show two output consoles from Tomcat: the server log (in catalina.out) and the server access log (in localhost.out).

When deploy locally make sure the profile deploy-local is activated. This way the logging.properties file will not be generated and the output will appear in the default netbeans console. From netbeans right-click on the desired project name;  from the list select Set Configuration. You should see deploy-local as one of the options in the list.

Redirection stdout and stderr to Logger on the Server

By default Tomcat will not redirect stdout and stderr to the Logger. This behaviour can be changed by setting the context parameter swallowOutput to true in context.xml.

Monitoring the log file

Use probe to monitor the log file produced by your application going to:

http://_serverName_.slac.stanford.edu:8080/probe/logs/

where serverName is the tomcat server on which the application has been deployed.

  • No labels