commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boris Unckel" <>
Subject RE: commons-logging discovery process
Date Wed, 08 Mar 2006 12:58:23 GMT
> Von: "Shai Wolf" <>
> 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 {
Log myTestLog = LogFactory.getLog("foo.test");
} catch (Exception e) {
 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 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.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message