commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Probst" <andpr...@gmx.net>
Subject Re: [logging] LogConfigurationException
Date Thu, 05 Jun 2003 05:09:48 GMT
Having read the two articles 

http://www.qos.ch/logging/thinkAgain.html
https://secure.zdnet.com.au/builder/program/java/story/0,20000347
79,20272367 ,00.htm

I think it's better not to use Commons-Logging in my app and 
certainly not within the test cases. Maybe I should use it in 
components which could be reused...

Craig, what do you think about the first article?

Regards,

Andreas


On 4 Jun 2003 at 8:03, Andreas Probst wrote:

> Thank you both Achim and Anthony for your replies.
> 
> I still can't get it to work. Achim, I tried your code - and it 
> works. Then I commented the junit-call out of the main method - 
> and it works.
> 
>     public static void main(String[] args)
>     {
>         //BasicConfigurator.configure();
>         logger.debug("test");
>         junit.swingui.TestRunner.run(AllTests.class);
>     }
> 
> If I run the code above, the "test" gets logged as expected, but 
> after that the exception below is thrown.
> 
> Is there a known issue with JUnit 3.7?
> 
> log4j: Finished configuring.
> 04 Jun 2003 07:50:21,122 DEBUG AllTests: test
> Exception in thread "main" java.lang.ExceptionInInitializerError
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorI
> mpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodA
> ccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at 
> junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:111)
>         at junit.awtui.TestRunner.runSuite(TestRunner.java:455)
>         at junit.awtui.TestRunner.start(TestRunner.java:536)
>         at junit.awtui.TestRunner.main(TestRunner.java:382)
>         at junit.awtui.TestRunner.run(TestRunner.java:387)
>         at de...AllTests.main(AllTests.java:29)
> 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
>         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)
>         at de...AllTests.<clinit>(AllTests.java:21)
>         ... 10 more
> Caused by: org.apache.commons.logging.LogConfigurationException: 
> org.apache.commons.logging.LogConfigurationException: Class 
> org.apache.commons.logging.impl.Log4JLogger does not implement 
> Log
>         at 
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
> LogFactoryImpl.java:416)
>         at 
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFac
> toryImpl.java:525)
>         ... 14 more
> Caused by: org.apache.commons.logging.LogConfigurationException: 
> Class org.apache.commons.logging.impl.Log4JLogger does not 
> implement Log
>         at 
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
> LogFactoryImpl.java:412)
>         ... 15 more
> 
> Andreas
> 
> On 2 Jun 2003 at 22:50, Achim Felber wrote:
> 
> > Andreas,
> > 
> > I think Anthony might be right; you could be using incompatible versions
> > of Log4J and commons-logging. Below is an application that worked for me. 
> > Make sure Log4J finds its configuration file. The debug switch can be quite 
> > helpfull too. ;-)
> > 
> > Regards,
> > Achim
> > ===========================================================
> > import org.apache.commons.logging.*;
> > import org.apache.log4j.*;
> > 
> > public class LogTest
> > {
> >   public static void main(String[] args)
> >   {
> >     LogFactory.getLog("TestLog").debug("Seems to work ...!");
> >   }
> > }
> > 
> > // java -Dlog4j.debug=true -Dlog4j.configuration=file:/c:/data/sort4.properties
LogTest
> > 
> > On Mon, Jun 02, 2003 at 01:58:27PM -0400, Anthony Eden wrote:
> > > 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
> > 
> > -- 
> > Achim Felber
> > e-mail: afelber@austin.rr.com
> > 
> > ---------------------------------------------------------------------
> > 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