views:

203

answers:

2

I'm using Tomcat 6, and this is my logging.properties:

handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.level=FINE

org.apache.catalina.core.ApplicationContext.level = OFF

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

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

On the one hand, Tomcat seems to read this file, as it correctly saves the logfiles with the prefix "mylog" and prints only messages with log-level FINE and above. On the other hand, it keeps on writing log messages like this:

Jun 8, 2010 9:53:30 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Error writing messages
ClientAbortException:  java.net.SocketException: Broken pipe

I actually wanted to suppress all log messages from this class, as they flood my logfile, and the error is irrelevant for me. So why is the following line ignored?

org.apache.catalina.core.ApplicationContext.level = OFF

Is there any other way to suppress the log output of this class?

+2  A: 

org.apache.catalina.core.ApplicationContext is not the name of the logger used in ApplicationContext, it uses the log of a composite: the org.apache.catalina.core.StandardContext's log.

--edit: Maybe it's because they're context loggers. Then they need to be configured differently

something like

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

I've not done that before, I've never used tomcat's logging facilities, and there is not much info to find

Redlab
I changed the line toorg.apache.catalina.core.StandardContext.level = OFFbut it still has the same log-output as before.
Bob
Setting org.apache.catalina.core.ContainerBase.level = OFF did the trick. Thanks!
Bob
no problem, thanks 2 kschneid too
Redlab
+2  A: 

I think Redlab's on the right track - notice that the root of the logger name is org.apache.catalina.core.ContainerBase, not org.apache.catalina.core.StandardContext. The method org.apache.catalina.core.ContainerBase.logName() controls the logger name and it explicitly starts with ContainerBase.class.getName(). Just to clarify, StandardContext extends ContainerBase.

kschneid