commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Achim Felber <afel...@austin.rr.com>
Subject Re: [logging] LogConfigurationException
Date Sun, 01 Jun 2003 23:26:22 GMT
Andreas,

I think you need to configure Log4J yourself. At the very least 
you need to tell it where to find the log4j.properties file for
instance by setting the log4j.configuration system property.

I could be wrong but, I think commons-logging is supposed to 
only provide a generic interface for the actual logging calls.
The configuration of the underlying logging package doesn't seem
to be within the scope of commons-logging. So, when you change
the actual logger, for instance convert from Log4J to the JDK1.4 logger 
you don't have to change every class, only the one which configures the
logger. Your actual application code stays the same.

Hope this helps,
Achim

On Sun, Jun 01, 2003 at 06:42:27PM +0200, Andreas Probst wrote:
> Hi all,
> 
> I'm trying to use commons-logging together with log4j.
> 
> Do I have to initialise log4j, i.e. load the log4j.properties? I 
> don't think so. If I have to configure it myself, I'm tied to 
> log4j. Then I could use it directly.
> 
> At the moment I get 
> 
> Caused by: org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: Class o
> g.apache.commons.logging.impl.Log4JLogger does not implement Log
>         at 
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFac
> toryImpl.java:532)
>         at 
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFac
> toryImpl.java:272)
>         at 
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFac
> toryImpl.java:246)
>         at 
> org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
> 
> I put the following code into my class:
> 
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> static Log logger = LogFactory.getLog(AllTests.class); 
> 
> Isn't this enough?
> 
> >From reading the source code I think log4j.jar has to be in 
> classpath. Right?
> 
> Thanks in advance for your help
> 
> Andreas
> 
> 
> ---------------------------------------------------------------------
> 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