This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "tomcat "logging.properties"" Watch "tomcat "logging.properties"" New topic
Author

tomcat "logging.properties"

Vinney Shanmugam
Ranch Hand

Joined: Aug 27, 2008
Posts: 104
handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, \
3manager.org.apache.juli.FileHandler, 4admin.org.apache.juli.FileHandler, \
java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

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

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

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

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

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

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


############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = \
2localhost.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = \
3manager.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/admin].handlers = \
4admin.org.apache.juli.FileHandler

# For example, set the com.xyz.foo logger to only log SEVERE
# messages:
#org.apache.catalina.startup.ContextConfig.level = FINE
#org.apache.catalina.startup.HostConfig.level = FINE
#org.apache.catalina.session.ManagerBase.level = FINE

This is the sample logging.properties. In this I dont understand the last commented out part. My understading was, say you have a application deployed in abc.efg.Sample.java(servlet),
then to enable logging for this file, I should have the following lines in logging.properties

abc.efg.Sample.handler = 2localhost.org.apache.juli.FileHandler

so all the log messages should go to localhost.log, right?


Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15962
    
  19

The docs on Tomcat logging are really confusing to me. They actually refer to logging from Tomcat itself and not the apps deployed in Tomcat. The apps have to define their own logging, and can use whatever logging system they want - juli, log4, commons.logging, or whatever. For log4j, put the log4j.xml or properties file at the root of the WAR's WEB-INF/classes directory. For juli, I think it actually refers back to the logging.properties of whatever JVM is running Tomcat (the JAVA_HOME/lib/logging.properties file). But I'm not certain, and there are override options.

The Tomcat juli logger actually puts out its logs with a datestamp as part of their names for the localhost log.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: tomcat "logging.properties"
 
Similar Threads
help configuring log4j properties file to mirror java.util.logging (juli) already in place
On-going logging problems
Starting Tomcat from Eclipse Problem
In tomcat6, System.err.println or System.out.println don't seem to work
loggers and handlers in tomcat