I found out your previous post about log4j wrapper has
the method:

/**
This code (from Ceki Gülcü) checks to see if there are
any appenders defined for log4j which is the
definitive way to tell if log4j is already initialised
**/
private static boolean isConfigured() {
   Enumeration enum =
Category.getRoo().getAllAppenders();
   if (!(enum instanceof
org.apache.log4j.helpers.NullEnumeration)) {
    return true;
   }
   else {
     Enumeration cats
=Category.getCurrentCategories();
     while (cats.hasMoreElements()) {
       Category c = (Category)cats.nextElement();
       if (!(c.getAllAppenders() instanceof
org.apache.log4j.helpers.NullEnumeration))            
          return true;
       }
      }
      return false;
     }
I think I could use it to detect the configuration
error on server start up, could I?


--- Mark Womack <[EMAIL PROTECTED]> wrote:
> I think this has been mentioned before.  There is no
> way currently to catch
> configuration or log errors thrown by lo4j.  I think
> that being able to
> detect configuration errors would be useful, but it
> would have to be done in
> a "right" way.
> 
> -Mark
> 
> > -----Original Message-----
> > From: xiaowen hu [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, March 28, 2002 4:45 PM
> > To: Log4J Users List
> > Subject: DOMConfigurator
> > 
> > 
> > Hi, all,
> > I am using xml file to config log4j, I used old
> jar
> > but have <log4j:configuration>, so the log4j is
> not
> > configured and returned, pritn ERROR on console. I
> was
> > not aware of that until i found out no logs are
> > written. 
> > 
> > But i need to catch this kind of configuration
> error
> > and stop my application. I noticed that no
> exception
> > thrown in config, in getting category, in log()
> > method.
> > How should i deal with the exception?
> > Thanks> 
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

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

Reply via email to