commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <>
Subject Re: Turning off commons logging
Date Mon, 02 Jun 2008 08:08:05 GMT
John B. Moore schrieb:
> I'm using a number of org.apache.commons libraries in a web project
> and I need to turn off the logging that is occurring within the
> commons.  I must confess that, though I have used Log4j for years, I
> only use it at a very basic level and still rely on a very basic
> property file. (shown at the bottom of this message)
> The commons libraries are generating massive amounts of output and I
> need to shut that off.
> I keep my file for a given webapp in:
> ../tomcat/webapps/applicationroot/conf/
> My first guess wast that it is seeing my core instance of Log4j and
> using that.. but when I add
> has no effect.. which makes me question that it is seeing my
> configuration file.
> Anyone have some hints as to getting the commons logging turned off
> without affecting my application logging.
> Thanks..
> John..
> ================ current log4j property file contents ===========
> log4j.rootLogger=DEBUG, A1, R1
> # A1 is a Console Appender
> log4j.appender.A1=org.apache.log4j.ConsoleAppender
> # R1 is a Rolling file appender
> log4j.appender.R1=org.apache.log4j.RollingFileAppender
> log4j.appender.R1.File=application.log
> # File Size
> log4j.appender.R1.MaxFileSize=100KB
> # Keep one backup file
> log4j.appender.R1.MaxBackupIndex=2
> # Output Patterns
> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> log4j.appender.A1.layout.ConversionPattern=%-4r [%t](%F:%L) %-5p - %m%n
> log4j.appender.R1.layout=org.apache.log4j.PatternLayout
> log4j.appender.R1.layout.ConversionPattern=%-4r [%t](%F:%L) %-5p - %m%n

I presume that your apps are using log4j directly, and are being
controlled by the config file you posted above, but libs that use
commons-logging are not? Are the commons lib messages getting the
ConversionPattern that you specify in your config file? If yes, then the
right config file is being seen, and you've just not got the log4j
command to set the threshold right.

Interestingly, the default logging level for almost all logging libs is
"INFO", and commons libs don't log much at INFO level or above. Yet you
say that you are getting "massive" amounts of logging. So it would
appear that somehow you have a config file in your environment that is
forcing logging to a level lower than the default.

You could try putting a file named "" in your
app's classpath with the following contents:
|This disables the "auto-discovery" feature of commons-logging, and
ensures that log4j is always used. I would have expected that
commons-logging would detect and use log4j automatically, but this will
guarantee it.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message