Unwanted Log4J output in a Tomcat app

Posted by Bytecode Ninja on Stack Overflow See other posts from Stack Overflow or by Bytecode Ninja
Published on 2010-04-18T06:34:25Z Indexed on 2010/04/18 6:43 UTC
Read the original article Hit count: 494

Filed under:
|
|
|

I have the following log4j config setup for my Web app which is being deployed to Tomcat:

# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=INFO, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%m%n

log4j.logger.org.hibernate=WARN
log4j.logger.org.apache=WARN

And it is being picked up by the Log4J as modifying the ConversionPattern affects the logs printed to the console. However there are unwanted and unasked-for logging outputs interleaving my log outputs as it can be seen in the following example:

Apr 18, 2010 4:14:55 PM com.acme.web.OpenSessionInViewFilter doFilter
INFO: Closing session
Apr 18, 2010 4:14:56 PM com.acme.web.OpenSessionInViewFilter doFilter
INFO: Entering
Apr 18, 2010 4:14:57 PM com.acme.web.OpenSessionInViewFilter doFilter
INFO: Commiting transaction
Apr 18, 2010 4:14:57 PM com.acme.web.OpenSessionInViewFilter doFilter
INFO: Closing session

Why are "Apr 18, 2010 4:14:57 PM com.acme.web.OpenSessionInViewFilter doFilter" and other similar log statements printed on the console? Also why are they not formatted according to my Log4J config?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about log4j

Related posts about tomcat