commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Eden ...@anthonyeden.com>
Subject Re: [logging] LogConfigurationException
Date Mon, 02 Jun 2003 17:58:27 GMT
You can also put the log4j.properties file in a location which is known 
to Log4J.  Take a look at the Default Initialization Procedure section 
in the short manual ( http://jakarta.apache.org/log4j/docs/manual.html ) 
for information on how Log4J attempts to find the properties file.

As for the specific problem, make sure you are using both the current 
version of Log4J and the current version of Commons Logging.  Also, 
check your whole classpath for other copies of either Commons Logging or 
Log4J.

Sincerely,
Anthony Eden

Andreas Probst wrote:
> Hi Achim,
> 
> thank you for your answer. You're right - I would have to change 
> the configuration only once. It's not what I expected, but OK, I 
> think I can live with it.
> 
> However, putting an 
> BasicConfigurator.configure();
> into the main() method doesn't solve the current problem:
> 
> Caused by: org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: Class 
> org.apache.commons.logging.impl.Log4JLogger does not implement 
> Log
> 
> Does anyone have a clue there?
> 
> Regards
> 
> Andreas
> 
> 
> On 1 Jun 2003 at 18:26, Achim Felber wrote:
> 
> 
>>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
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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