Discussion:
Help with Log Level in Tomcat 6 Logging
Jonathan Jackson
2010-06-17 12:17:45 UTC
Permalink
Hello,


Im a newbie to Tomcat logging.
Here is the logging.properties of my Catalina installation:
-------------------------------------------------------------------------------------------
handlers = 1catalina.org.apache.juli.FileHandler,
2localhost.org.apache.juli.FileHandler,
3manager.org.apache.juli.FileHandler,
4host-manager.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.

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

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].[/host-manager].level
= INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers
= 4host-manager.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
#org.apache.catalina.core.AprLifecycleListener.level=FINE
----------------------------------------------------------------------------------------------------------------

The problem I have is that in my daily rolling catalina-[data].out I only
get SEVERE level messages.
Given the above configuration, my understanding from reading this (
http://tomcat.apache.org/tomcat-6.0-doc/logging.html) is that FINE for the
FileHandler would log everything above ie. FINE,CONFIG,INFO,WARNING....But
Im only getting SEVERE written to my daily rolling logfile.

Im not sure how to change this behaviour even after reading through -
http://tomcat.apache.org/tomcat-6.0-doc/logging.html -
and any advice is appreciated.

Thanks
Jon
André Warnier
2010-06-17 12:36:22 UTC
Permalink
Jonathan Jackson wrote:
...
Hi.
If it may contribute to less confusion : for as long as I remember, and still in tomcat
6.0.26 e.g., the comment in front of this paragraph at the end of the logging.properties file
Post by Jonathan Jackson
# For example, set the com.xyz.foo logger to only log SEVERE
#org.apache.catalina.startup.ContextConfig.level = FINE
#org.apache.catalina.startup.HostConfig.level = FINE
#org.apache.catalina.session.ManagerBase.level = FINE
#org.apache.catalina.core.AprLifecycleListener.level=FINE
----------------------------------------------------------------------------------------------------------------
has had a comment totally out of sync with the lines that follow.
Unfortunately, I do not know how to rectify it, because Tomcat logging has long been a
mysterious area where I fear to walk alone even by day.
Konstantin Kolinko
2010-06-17 13:37:29 UTC
Permalink
Post by Jonathan Jackson
The problem I have is that in my daily rolling catalina-[data].out I only
get SEVERE level messages.
Given the above configuration, my understanding from reading this (
http://tomcat.apache.org/tomcat-6.0-doc/logging.html) is that FINE for the
FileHandler would log everything above ie. FINE,CONFIG,INFO,WARNING....But
Im only getting SEVERE written to my daily rolling logfile.
The Tomcat JULI logging is an implementation of java.util.logging (aka
JUL), which documentation is here,
http://java.sun.com/javase/6/docs/api/java/util/logging/package-summary.html#package_description

http://java.sun.com/javase/6/docs/api/java/util/logging/Level.html

http://java.sun.com/javase/6/docs/technotes/guides/logging/index.html

etc.


To make a brief summary, there are two levels where log messages are filtered:
a) at the category (aka "logger") level

If level of a category (if not specified then its parent level is
taken) does not match the message, it will be rejected by the logging
system and will not be processed at all.


That is what these lines are for:
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level
org.apache.catalina.core.AprLifecycleListener.level

The categories form a hierarchy, and the default level is specified by
.level= INFO


Note, that the "org.apache.catalina.core.ContainerBase.[Catalina].[localhost]"
category is for the messages logged through Servlet.log() API calls,
which I think is rare.

Usually applications use commons-logging calls and their category
names are different. Thus the defaults (.level=INFO) apply to them.

There is no ".level= INFO" in Tomcat's logging.properties because the
defaults are provided by JRE through its logging.properties. But you
can always add such a line by yourself, e.g.

.level= FINEST
will cause a lot of messages being processed

b) when writing the message out (aka "handler") level

If handler level does not match the message, it will be skipped (but
may be printed by other handlers).

<categoryname>.handler setting attaches handlers to a category.


I think you missed a).

By the way,
Post by Jonathan Jackson
.handlers = 1catalina.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler
I hope that those lines were wrapped by the mailing software. You
cannot wrap lines in a properties file like that (though you can if
you end previous line with '\'). see java.util.Properties JavaDoc.


Best regards,
Konstantin Kolinko
Jonathan Jackson
2010-06-18 08:11:27 UTC
Permalink
Konstantin,


Thanks very much for your time.
Your explanation makes things clearer.

cheers
Jon
Post by Jonathan Jackson
Post by Jonathan Jackson
The problem I have is that in my daily rolling catalina-[data].out I only
get SEVERE level messages.
Given the above configuration, my understanding from reading this (
http://tomcat.apache.org/tomcat-6.0-doc/logging.html) is that FINE for
the
Post by Jonathan Jackson
FileHandler would log everything above ie.
FINE,CONFIG,INFO,WARNING....But
Post by Jonathan Jackson
Im only getting SEVERE written to my daily rolling logfile.
The Tomcat JULI logging is an implementation of java.util.logging (aka
JUL), which documentation is here,
http://java.sun.com/javase/6/docs/api/java/util/logging/package-summary.html#package_description
http://java.sun.com/javase/6/docs/api/java/util/logging/Level.html
http://java.sun.com/javase/6/docs/technotes/guides/logging/index.html
etc.
a) at the category (aka "logger") level
If level of a category (if not specified then its parent level is
taken) does not match the message, it will be rejected by the logging
system and will not be processed at all.
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level
org.apache.catalina.core.AprLifecycleListener.level
The categories form a hierarchy, and the default level is specified by
.level= INFO
Note, that the
"org.apache.catalina.core.ContainerBase.[Catalina].[localhost]"
category is for the messages logged through Servlet.log() API calls,
which I think is rare.
Usually applications use commons-logging calls and their category
names are different. Thus the defaults (.level=INFO) apply to them.
There is no ".level= INFO" in Tomcat's logging.properties because the
defaults are provided by JRE through its logging.properties. But you
can always add such a line by yourself, e.g.
.level= FINEST
will cause a lot of messages being processed
b) when writing the message out (aka "handler") level
If handler level does not match the message, it will be skipped (but
may be printed by other handlers).
<categoryname>.handler setting attaches handlers to a category.
I think you missed a).
By the way,
Post by Jonathan Jackson
.handlers = 1catalina.org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler
I hope that those lines were wrapped by the mailing software. You
cannot wrap lines in a properties file like that (though you can if
you end previous line with '\'). see java.util.Properties JavaDoc.
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
Loading...