You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Alex <al...@optonline.net> on 2006/04/02 03:00:38 UTC

[common-logging] disabling logging

I can't seem to get disabling logging to work.

I made a jar file put another file 'commons-logging.properties' inside of
it. Added text
'org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog'
To it. Put it the first thing in my CLASSPATH and logging still shows up...

Any ideas?
Thanks


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


Re: [common-logging] disabling logging

Posted by Simon Kitching <sk...@apache.org>.
Hi Alex,

On Sat, 2006-04-01 at 20:00 -0500, Alex wrote:
> I can't seem to get disabling logging to work.
> 
> I made a jar file put another file 'commons-logging.properties' inside of
> it. Added text
> 'org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog'
> To it. Put it the first thing in my CLASSPATH and logging still shows up...
> 
> Any ideas?

You mean you've created a jarfile 'foo.jar' containing
commons-logging.properties (and maybe some other stuff), and added
foo.jar to the classpath?

I presume you've put the commons-logging.properties file at the top
level, not nested under something like net.optonline.foo.

The thing most likely to be wrong is that somehow your jar is *not* the
first thing on the classpath.

Is the code you're running a stand-alone app, a webapp, or something
else? If you're talking about a webapp, then there are of course
multiple classpaths involved. Generally, environments like Tomcat ignore
any CLASSPATH environment variable and set their own for example.

If you can add something like this to your code it would help debugging
this issue:
  Enumeration e = Thread.currentThread.getContextClassLoader().
    getResources("commons-logging.properties");
  while (e.hasMoreElements()) {
     System.out.println(e.nextElement());
  }
That will show where the commons-logging.properties file really occurs on the classpath.

Which version of commons-logging are you using?

Regards,

Simon


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