Dave,

My proposed solution is to introduce a method such
as the following in your library:

void disableWinWardLogging() {
   if(winWardLoggingEnabled)
      return;

   Category cat = Category.getInstance("net.winward");
   cat.setPriority(Priority.FATAL);

   // In log4j 1.2
   // Logger logger = Logger.getLogger("net.winward");
   // logger.setLevel(Level.OFF);
}

The question is whether your library can call disableWinWardLogging
early in its initialization and how and when the winWardLoggingEnabled
is set.

Please let me know if this approach works for your library.

At 17:30 30.03.2002 -0700, David Thielen wrote:

>----- Original Message -----
>From: "Ceki Gülcü" <[EMAIL PROTECTED]>
>To: "Log4J Users List" <[EMAIL PROTECTED]>
>Sent: Saturday, March 30, 2002 3:11 AM
>Subject: Re: Making the log4j library optional
>
>
> > At 15:36 29.03.2002 -0700, you wrote:
> > >Hi;
> > >
> > >Here's my problem. I'm creating a 3rd party library that people will use
> > >for their applications. I need to do no logging and I need to not require
> > >log4j when they use my library (first, if I log then I fill up their logs
> > >with stuff that means nothing to them and second, what if they use an
> > >incompatible version of log4j).
> >
> > First, you would be surprised by the number of libraries that already
> > require log4j. Second, we go to great pains to ensure that all
> > versions of log4j are backward compatible. So I don't understand the
> > comment about incompatible versions of log4j.
>
>Ok, if it's always going to be backward compatible, then that brings me back
>to my earlier question. How can I tell it to write out nothing for all
>packages in my jar - ie net.windward.*[.*[.*[...]]]. Because if someone is
>using my library, I don't want to fill up their logs with a bunch of stuff
>that means nothing to them. I need this for log4j 1.1 (since I can't require
>users of my library to switch to 1.2).
>
>thanks - dave

--
Ceki
My link of the month: 
http://www.suntimes.com/output/otherviews/cst-edt-ref31.html


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

Reply via email to