commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boris Unckel" <boris.unckel....@gmx.net>
Subject RE: commons-logging discovery process
Date Wed, 08 Mar 2006 12:58:23 GMT
> Von: "Shai Wolf" <shai.wolf@coridan.com>
> Regarding your answer, I read the documentation of the latest release and
> I
> still didn't find a way to know the detection status PROGRAMMATICALLY.
There is no way to check it programmatically. One workaround just for JCL:
boolean noError = true;
try {
LogFactory.getLogFactory();
Log myTestLog = LogFactory.getLog("foo.test");
myTestLog.debug("test");
} catch (Exception e) {
 e.printStacktrace();
 noError = false;
}
But this would just work for JCL and NOT the underlying log API.

> That
> means that I am looking for an API method to check the initialization
> state
> E.g. isInitiated() or hasAppenders(). Something that will tell me it's ok
> to
> start calling Log.info() and so on. It can also be an attribute that was
> set
> during the initialization.
There is no method/attribute as I know.

> Currently, if I call this method when no appenders are set, I will get the
> message (when using log4j):
> log4j:WARN No appenders could be found for logger (Logger_Name).
> log4j:WARN Please initialize the log4j system properly.
> 
> Is there a way to overcome this?
Even if log4j would offer a method like this it could not be in JCL because
JCL is meant to be log API _independent_.

In summary: There is currently no correct way to check the full chain of JCL
and the underlying log API programmatically.

Why do you need this? If you detect an error your programm can run without
log or terminate. The user/admin still must check why there is an error and 
she would have to lookup the System.out / System.err for this.

Regards
Boris

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message