commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <>
Subject Re: Turning off commons logging
Date Tue, 03 Jun 2008 07:03:42 GMT
John B. Moore schrieb:
> I searched carefully the entire classpath (JBuilder has a view that
> shows you the entire classpath used on startup) and I did find A
> general file in the:
> Versions/1.5.0/Home/lib/
> .. with the following settings..
> #==========================================
> # Default global logging level.
> .level= INFO
> # default file output is in user's home directory.
> java.util.logging.FileHandler.pattern = %h/java%u.log
> java.util.logging.FileHandler.limit = 50000
> java.util.logging.FileHandler.count = 1
> java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
> # Limit the message that are printed on the console to INFO and above.
> java.util.logging.ConsoleHandler.level = INFO
> java.util.logging.ConsoleHandler.formatter =
> java.util.logging.SimpleFormatter
> #============================================
> .. which does not seem to be in effect with commons because I'm seeing
> DEBUG output..
And that's a java.util.logging configuration file. The default layout
for java.util.logging looks quite different from log4j; from the output
examples you showed, I'm pretty confident that it is log4j that is
generating that output, not java.util.logging.
> The only other "properties" files I could find in that path had no
> mention of logging in general or log4j in particular..
> (I also used "SpotLight" which searched the entire hard drive and only
> found what I expected to find and where I expected to find it..)
Ok, worth a try.
>> As a last resort, you could edit that file to
>> specify NoOpLog rather than Log4JLog. That should block all messages
>> logged via commons-logging, although all messages logged directly to
>> log4j will not be affected. That isn't the best solution of course.
> That worked..  But you are right not a good solution..  Is there
> something else I could put in that file that would allow only ERROR
> messages to come through..?
Well, I suppose you could try configuring to
use the "org.commons.logging.impl.SimpleLog" implementation, then set a
system property to configure SimpleLog. However that's still a hack.
Really, you do want to pass messages through to log4j rather than use
the (deliberately dumb) SimpleLog class.

Commons-logging's job is specifically to find the appropriate underlying
log instance to pass messages onto, and try to do as little else as it
possibly can. Even "finding the underlying log instance" turns out to be
quite complicated when strange classloader hierarchies are involved.
Commons-logging specificically does NOT do any filtering of messages it
passes through to the underlying logging implementation.

So there is no option for it to filter messages by threshold while still
using log4j.

Is this problem occurring when you run your webapp from the commandline,
or are you always running it from within JBuilder? If you are always
using JBuilder, then maybe JBuilder sets up some odd classloader
hierarchy that includes a log4j config file from jbuilder itself..

I also know that the JBoss classloader specifically looks for
commons-logging and treats it as a special case, returning a class from
an unexpected classloader. This wasn't the brightest move on their part.
But I think you're just using plain tomcat....if so then there is no
problem as tomcat has no hacks like this.


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

View raw message