You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "John B. Moore" <jb...@esonicspider.com> on 2008/06/02 02:25:15 UTC

Turning off commons logging

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 log4j.properties file for a given webapp in:

../tomcat/webapps/applicationroot/conf/log4j.properties

My first guess wast that it is seeing my core instance of Log4j and 
using that.. but when I add

log4j.logger.org.apache.commons=ERROR

..it 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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Turning off commons logging

Posted by "John B. Moore" <jb...@esonicspider.com>.
Dennis Lundberg wrote:
> 
> The place where we put our log4j configuration file in webapps is
> 
> .../tomcat/webapps/myWebapp/WEB-INF/classes/logj4.properties
> 
> That puts it on the classpath for the webapp.

Yes thanks for reminding me.. I do now remember that, and the reason for 
it being where it is at is so I can control who sees that file.

> 
> If you have it in the place you mentioned above, I don't think that it 
> will be found by Log4j being called through Commons Logging.

I agree, I did copy a version of that to the .../classes directory and 
it had NO effect..  Why, I don't have a clue, one would think it would.


Thanks for your reminders and suggestions.

John..


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Turning off commons logging

Posted by Dennis Lundberg <de...@apache.org>.
John B. Moore wrote:
> 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 log4j.properties file for a given webapp in:
> 
> ../tomcat/webapps/applicationroot/conf/log4j.properties

The place where we put our log4j configuration file in webapps is

.../tomcat/webapps/myWebapp/WEB-INF/classes/logj4.properties

That puts it on the classpath for the webapp.

If you have it in the place you mentioned above, I don't think that it 
will be found by Log4j being called through Commons Logging.

> My first guess wast that it is seeing my core instance of Log4j and 
> using that.. but when I add
> 
> log4j.logger.org.apache.commons=ERROR
> 
> ..it 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
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
> 


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Turning off commons logging

Posted by "simon.kitching@chello.at" <si...@chello.at>.
Pierre Brico schrieb:
> Hi all,
>
> I have a similar problem with my application. This is a java application
> (not using any application server).
>
> I use commons-logging for logging puposes and log4j as implementation. This
> is working (I mean I got the log) but it is impossible to deactivate the
> log. All log informations go to a file named "extern.log" in the directory
> from which the application is launched.
>
> The log level is always DEBUG (however I mentioned ERROR in the log4.xml)
> and the format is the same as
>
> 2008-05-29 12:57:30,829.1   [main] DEBUG com.tsdsoftware.ouat  - Environment
> used for the WS call: T24JBDEV
>
> I have create a commons-logging.properties file to force it to use the log4j
> implementation and avoid the discovery procedure but it didn't change
> anything to the log level.
> As my application is running on Windows with jdk1.6, I tried to trace all
> API calls to the system with Processmonitor (
> http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx?PHPSESSID=d926)
> and I saw that the JVM accessed to the log4j.xml configuration file. But the
> level stays DEBUG and the output file stays extern.log. (I'm wondering where
> this filename comes from. I searched all source files of log4j and
> commons-logging but didn't find this 'default' name).
>
> Any idea ?
>   
Well I can promise you 100% that filename is nowhere within
commons-logging or any commons library. And I very much doubt it is
anywhere within log4j; log4j defaults to doing nothing when not
configured (except for writing two lines of text to stderr).

As I don't have your environment, I cannot guess what might be setting
this. But something is.

Regards,
Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Turning off commons logging

Posted by Pierre Brico <pi...@tsdsoftware.eu>.
Hi all,

I have a similar problem with my application. This is a java application
(not using any application server).

I use commons-logging for logging puposes and log4j as implementation. This
is working (I mean I got the log) but it is impossible to deactivate the
log. All log informations go to a file named "extern.log" in the directory
from which the application is launched.

The log level is always DEBUG (however I mentioned ERROR in the log4.xml)
and the format is the same as

2008-05-29 12:57:30,829.1   [main] DEBUG com.tsdsoftware.ouat  - Environment
used for the WS call: T24JBDEV

I have create a commons-logging.properties file to force it to use the log4j
implementation and avoid the discovery procedure but it didn't change
anything to the log level.
As my application is running on Windows with jdk1.6, I tried to trace all
API calls to the system with Processmonitor (
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx?PHPSESSID=d926)
and I saw that the JVM accessed to the log4j.xml configuration file. But the
level stays DEBUG and the output file stays extern.log. (I'm wondering where
this filename comes from. I searched all source files of log4j and
commons-logging but didn't find this 'default' name).

Any idea ?

Thanks,
Pierre


On Tue, Jun 3, 2008 at 3:39 AM, John B. Moore <jb...@esonicspider.com> wrote:

> simon wrote:
>
>  Again, if you could follow my suggestion and change the output pattern a
>> little, that would be useful. If the problem messages do not change,
>> then that proves a different config file is in use.
>>
>
> What I had done is to set logging to OFF  it turned of my internal code's
> logging but did not touch the commons logging..
>
> My conclusion was that it was not seeing the config file..
>
> I then moved a copy to the /WEB-INF/classses
>
> I then also turn off the logging in that file..
>
> ..no joy.. (and the pattern is different..)
>
> My pattern
>
> 6450 [http-8080-Processor3](BaseServiceBean.java:240) DEBUG -
> BaseServiceBean - getPath: IndexPath
>
> the commons logging pattern
>
> 2008-06-02 17:58:20,901 DEBUG [org.apache.commons.digester.Digester.sax] -
> endElement(,,web-app)
>
> ..with the date and time..
>
>
>> Hmm. Mac OSX. Maybe you should check the JVM files themselves, just
>> because I've never heard of anyone having this problem before and that
>> is a less-common platform. Didn't java1.5 just get released for Mac a
>> few weeks ago? Are you using that brand new release?
>>
>
>
> 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
> logging.properties file in the:
>
> Versions/1.5.0/Home/lib/logging.properties
>
> .. 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..
>
> 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..)
>
>
>
>> There is an option to force commons-logging to output some diagnostics
>> which *might* be useful in your case. See the link titled
>> "Troubleshooting guide" on the commons-logging website.
>>
>
> Thanks I will review that...
>
>
>> I'm 95% sure that the issue is that you have another log4j config file
>> somewhere in your classpath. And that it is NOT inside a commons
>> jarfile.
>>
>
> I wish you where right... so far I have not been able to find such a file..
>
>
>
>> As a last resort, you could edit that commons-logging.properties 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..?
>
> Thanks for your patience and assistance..
>
> John...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: Turning off commons logging

Posted by "John B. Moore" <jb...@esonicspider.com>.
simon.kitching@chello.at wrote:
> 
> Is this problem occurring when you run your webapp from the commandline,
> or are you always running it from within JBuilder? 

For testing only.. in production it runs on Apache/Tomcat combination on 
CentOS..


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 doubt that, been using JBuilder since v1 so I'm pretty familiar with 
what it does.. (and does not) ..do..


I'll keep researching this as I have time, the short term problem has be 
"hacked" into a solution that I can live with for now..

Thanks again for you assistance..

John..

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Turning off commons logging

Posted by "simon.kitching@chello.at" <si...@chello.at>.
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 logging.properties file in the:
>
> Versions/1.5.0/Home/lib/logging.properties
>
> .. 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 commons-logging.properties 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 commons-logging.properties 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.

Regards,
Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Turning off commons logging

Posted by "John B. Moore" <jb...@esonicspider.com>.
simon wrote:

> Again, if you could follow my suggestion and change the output pattern a
> little, that would be useful. If the problem messages do not change,
> then that proves a different config file is in use.

What I had done is to set logging to OFF  it turned of my internal 
code's logging but did not touch the commons logging..

My conclusion was that it was not seeing the config file..

I then moved a copy to the /WEB-INF/classses

I then also turn off the logging in that file..

..no joy.. (and the pattern is different..)

My pattern

6450 [http-8080-Processor3](BaseServiceBean.java:240) DEBUG - 
BaseServiceBean - getPath: IndexPath

the commons logging pattern

2008-06-02 17:58:20,901 DEBUG [org.apache.commons.digester.Digester.sax] 
- endElement(,,web-app)

..with the date and time..

> 
> Hmm. Mac OSX. Maybe you should check the JVM files themselves, just
> because I've never heard of anyone having this problem before and that
> is a less-common platform. Didn't java1.5 just get released for Mac a
> few weeks ago? Are you using that brand new release?


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 
logging.properties file in the:

Versions/1.5.0/Home/lib/logging.properties

.. 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..

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..)


> 
> There is an option to force commons-logging to output some diagnostics
> which *might* be useful in your case. See the link titled
> "Troubleshooting guide" on the commons-logging website.

Thanks I will review that...

> 
> I'm 95% sure that the issue is that you have another log4j config file
> somewhere in your classpath. And that it is NOT inside a commons
> jarfile.

I wish you where right... so far I have not been able to find such a file..


> 
> As a last resort, you could edit that commons-logging.properties 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..?

Thanks for your patience and assistance..

John...

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Turning off commons logging

Posted by simon <si...@chello.at>.
On Mon, 2008-06-02 at 12:36 -0700, John B. Moore wrote:
> > but libs that use commons-logging are not? 
> 
> Apparently not.. If I set it to:
> 
> log4j.rootLogger=OFF, A1, R1
> 
> ..and the commons continued to output.. as in: (a brief sample)
> 
> 2008-06-02 12:06:35,801 DEBUG [org.apache.commons.digester.Digester.sax] 
> - startPrefixMapping(xml,http://www.w3.org/XML/1998/namespace)
> 2008-06-02 12:06:35,801 DEBUG [org.apache.commons.digester.Digester.sax] 
> - startPrefixMapping(xmlns,http://www.w3.org/2000/xmlns/)
> 2008-06-02 12:06:35,801 DEBUG [org.apache.commons.digester.Digester.sax] 
> - startElement(,,extension)
> 2008-06-02 12:06:35,801 DEBUG [org.apache.commons.digester.Digester] - 
>   Pushing body text '
> 
> .. obviously it thinks there is a DEBUG setting.

Yes, and that is odd. 

This looks to me like the default formatting for log4j. In other words,
it does look like log4j output rather than java.util.logging or other.

But Commons-logging does not set any logging levels at all, and log4j defaults to INFO. So this suggests that *somewhere* in your classpath is another log4j configuration file which is enabling debug-level. But it is definitely not in any of the commons project jarfiles; any commons project that tried to release a jar with a logging config file in it would get voted down.


> 
> 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.
> 
> So I assume that there is some setting or properties file embedded 
> somewhere in the libs..??

Well, as noted above it won't be in any of the commons jars.

Again, if you could follow my suggestion and change the output pattern a
little, that would be useful. If the problem messages do not change,
then that proves a different config file is in use.

> 
> I use JBuilder and therefore the classpath is tightly controlled and is 
> not associated with any classpath elsewhere in my system (Mac OSX 
> 10.5.2)  I've used some of the commons before and never had this issue 
> come up, hence the mystery..

Hmm. Mac OSX. Maybe you should check the JVM files themselves, just
because I've never heard of anyone having this problem before and that
is a less-common platform. Didn't java1.5 just get released for Mac a
few weeks ago? Are you using that brand new release?

> 
> I'm using
> 
> commons-beanutils-bean-collections.jar
> commons-beanutils-core.jar
> commons-beanutils.jar
> commons-codec-1.3.jar
> commons-collections-3.2.1.jar
> commons-httpclient-3.2.1.jar
> commons-lang-2.4.jar
> commons-logging-1.1.1.jar
> 
> I've used commons-collections on occasion with out seeing this effect, 
> but this is the FIRST time I've use so many (due to another library that 
> has all of these as dependencies and yes I check that source and 
> directories for any logging properties files.)
> 
> 
> > 
> > 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.
> 
> To my knowledge there is only one as listed previously..
> 
> 
> > 
> > You could try putting a file named "commons-logging.properties" in your
> > app's classpath 
> 
> I did this and it had no effect.. I assume it was because it is not 
> seeing my config file and is seeing something else..?

It's not too surprising it had no effect. I thought that commons-logging
was probably auto-detecting log4j, and so forcing it to use log4j makes
no difference.

There isn't a way for commons-logging to force log4j to choose a
specific config file. How log4j chooses to initialise itself is log4j's
business.

Maybe there is a system property that will force log4j to output
diagnostics about which config file it is using? That info would of
course be in the log4j docs, not commons-logging.

There is an option to force commons-logging to output some diagnostics
which *might* be useful in your case. See the link titled
"Troubleshooting guide" on the commons-logging website.

I'm 95% sure that the issue is that you have another log4j config file
somewhere in your classpath. And that it is NOT inside a commons
jarfile.

As a last resort, you could edit that commons-logging.properties 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.


Regards,
Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Turning off commons logging

Posted by "John B. Moore" <jb...@esonicspider.com>.
Simon,

Thank you for taking the item to offer some suggestions. I will clarify 
some things and maybe that will lead to further ideas toward a solution.

simon.kitching@chello.at wrote:
> I presume that your apps are using log4j directly, and are being
> controlled by the config file you posted above, 

Correct

> but libs that use commons-logging are not? 

Apparently not.. If I set it to:

log4j.rootLogger=OFF, A1, R1

..and the commons continued to output.. as in: (a brief sample)

2008-06-02 12:06:35,801 DEBUG [org.apache.commons.digester.Digester.sax] 
- startPrefixMapping(xml,http://www.w3.org/XML/1998/namespace)
2008-06-02 12:06:35,801 DEBUG [org.apache.commons.digester.Digester.sax] 
- startPrefixMapping(xmlns,http://www.w3.org/2000/xmlns/)
2008-06-02 12:06:35,801 DEBUG [org.apache.commons.digester.Digester.sax] 
- startElement(,,extension)
2008-06-02 12:06:35,801 DEBUG [org.apache.commons.digester.Digester] - 
  Pushing body text '

.. obviously it thinks there is a DEBUG setting.

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.

So I assume that there is some setting or properties file embedded 
somewhere in the libs..??

I use JBuilder and therefore the classpath is tightly controlled and is 
not associated with any classpath elsewhere in my system (Mac OSX 
10.5.2)  I've used some of the commons before and never had this issue 
come up, hence the mystery..

I'm using

commons-beanutils-bean-collections.jar
commons-beanutils-core.jar
commons-beanutils.jar
commons-codec-1.3.jar
commons-collections-3.2.1.jar
commons-httpclient-3.2.1.jar
commons-lang-2.4.jar
commons-logging-1.1.1.jar

I've used commons-collections on occasion with out seeing this effect, 
but this is the FIRST time I've use so many (due to another library that 
has all of these as dependencies and yes I check that source and 
directories for any logging properties files.)


> 
> 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.

To my knowledge there is only one as listed previously..


> 
> You could try putting a file named "commons-logging.properties" in your
> app's classpath 

I did this and it had no effect.. I assume it was because it is not 
seeing my config file and is seeing something else..?


John..

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: Turning off commons logging

Posted by "simon.kitching@chello.at" <si...@chello.at>.
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 log4j.properties file for a given webapp in:
>
> ../tomcat/webapps/applicationroot/conf/log4j.properties
>
> My first guess wast that it is seeing my core instance of Log4j and
> using that.. but when I add
>
> log4j.logger.org.apache.commons=ERROR
>
> ..it 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 "commons-logging.properties" in your
app's classpath with the following contents:
| 
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
|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.

Regards,
Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org