The only other log4j code I have is the following in each .java file:

    static Category log = Category.getInstance
(ProcessReport.class.getName());

And log.debug(), log.info(), ... calls throughout.

It all works fine if I do call    PropertyConfigurator.configure (
propFile ); with my properties file. The problems occurs if I call the code
below instead of configure.

Any ideas?????

thanks - dave


----- Original Message -----
From: "Ceki Gülcü" <[EMAIL PROTECTED]>
To: "Log4J Users List" <[EMAIL PROTECTED]>
Sent: Thursday, March 14, 2002 3:38 PM
Subject: Re: Turning off my logging programmatically



Sorry but this is supposed to work. What are you doing exactly (your code is
incomplete right?) and what do you think isn't working?

At 14:17 14.03.2002 -0700, David Thielen wrote:
>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]>
> >
> >

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

Reply via email to