If I understand it correctly, David wants to disable
part of the hierarchy (the part under "net.winward"). He does
not want to disable the whole hierarchy.

At 15:30 14.03.2002 -0700, you wrote:
>This is what I use for log4j v1.2:
>
>  Enabling:
>         LoggerRepository hierarchy = LogManager.getLoggerRepository();
>         hierarchy.setThreshold(Level.ALL);
>  Disabling:
>         LoggerRepository hierarchy = LogManager.getLoggerRepository();
>         hierarchy.setThreshold(Level.OFF);
>
>
>
>This is what I use for log4j v1.1.3:
>
>  Enabling:
>         Hierarchy hierarchy = Logger.getDefaultHierarchy();
>         hierarchy.enableAll();
>  Disabling:
>         Hierarchy hierarchy = Logger.getDefaultHierarchy();
>         hierarchy.disableAll();
>
>Your warning appears as you do not have any appenders in your Category.
>
>
>
>----- Original Message -----
>From: "David Thielen" <[EMAIL PROTECTED]>
>To: "Log4J Users List" <[EMAIL PROTECTED]>
>Sent: Thursday, March 14, 2002 2:17 PM
>Subject: Re: Turning off my logging programmatically
>
>
>Hi;
>
>Didn't work. (Well, mostly didn't work.) Here is the code:
>
>Category cat = Category.getInstance("net.winward");
>System.out.println( "cat = " + cat );
>cat.setPriority(Priority.FATAL);
>
>And here is what I got at the console:
>
>cat = org.apache.log4j.Category@f62373
>log4j:ERROR No appenders could be found for category 
>(net.windward.xmlreport.Pro
>cessReport).
>log4j:ERROR Please initialize the log4j system properly.
>
>Any other way?
>
>thanks - dave
>
>
>----- Original Message -----
>From: "Ceki Gülcü" <[EMAIL PROTECTED]>
>To: "Log4J Users List" <[EMAIL PROTECTED]>
>Sent: Thursday, March 14, 2002 12:59 AM
>Subject: Re: Turning off my logging programmatically
>
>
> >
> > Have you tried the following?
> >
> > (in log4j 1.1.x or log4j 1.2)
> >
> > if(!condition) {
> >    Category cat = Category.getInstance("net.winward");
> >    cat.setPriority(Priority.FATAL);
> > }
> >
> > (in log4j 1.2 only)
> >
> > if(!condition) {
> >    Logger logger = Logger.getLogger("net.winward");
> >    logger.setLogger(Level.OFF);
> > }
> >
> > 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
> >
> > --
> > Ceki
> >
> >
> > --
> > To unsubscribe, 
> e-mail:   <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
Ceki


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to