logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: Turning off my logging programmatically
Date Thu, 14 Mar 2002 07:59:57 GMT

Have you tried the following?

(in log4j 1.1.x or log4j 1.2)

if(!condition) {
   Category cat = Category.getInstance("net.winward");

(in log4j 1.2 only)

if(!condition) {
   Logger logger = Logger.getLogger("net.winward");

Hope this helps, Ceki

At 16:42 13.03.2002 -0700, you wrote:
>Hi all;
>I have a library that I ship to people as a jar. Here is what I would like 
>to be able to do:
>1) If they have a given property set, I use the value of that property as 
>my log4j configuration properties and do a configure with that. Works great.
>2) However, if they give me no file, I want to disable all logging from my 
>library without effecting their code. That means if they are using log4j, 
>I don't effect their settings in any way AND I do no logging. If they 
>don't use log4j, then I want nothing to happen - no logging of any kind. I 
>tried the following but it dodn't work:
>    PropertyConfigurator.configure ();
>    Hierarchy h = new Hierarchy( Category.getInstance ( "net.windward" )); 
> // all my code is net.windward.*****
>    h.disableAll();
>Any ideas?
>thanks - dave


To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

View raw message