You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by xiaowen hu <xw...@yahoo.com> on 2002/04/03 19:46:14 UTC

RE: DOMConfigurator

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 <mw...@bevocal.com> 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:xwhu_1999@yahoo.com]
> > 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:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


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

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>