dcsimg
Commons-Logging problem,
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Amir_Pashazadeh
Posted On:   Tuesday, May 27, 2003 11:42 PM

Hi I have a strange problem, I want to use Jakarta Commons-Logging as a common interface for logging systms in project. When I write the following code in a spike tester class: package spike.commonlogging; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class CommonLoggingTest { public static void main(String[] args) { Log l = LogFactory.getLog(CommonLoggingTest.class); l.debug("this is debug"); l.warn("this is warning"); l.info(l.getClass().getName()); } } for testing commons-logging the result will be (I use JD   More>>

Hi


I have a strange problem, I want to use Jakarta Commons-Logging as a common interface for logging systms in project.



When I write the following code in a spike tester class:

			

package spike.commonlogging;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class CommonLoggingTest {

public static void main(String[] args) {
Log l = LogFactory.getLog(CommonLoggingTest.class);

l.debug("this is debug");

l.warn("this is warning");

l.info(l.getClass().getName());
}
}


for testing commons-logging the result will be (I use JDK 1.4) :
			

May 22, 2003 10:36:59 AM spike.commonlogging.CommonLoggingTest main
WARNING: this is warning
May 22, 2003 10:36:59 AM spike.commonlogging.CommonLoggingTest main
INFO: org.apache.commons.logging.impl.Jdk14Logger


It seems that every thing works correct. But when I use the similar code to get the Log instance in another class, when I test the methods of my class using JUnit I get the following exception:
			

org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:532)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:272)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:414)
at com.tartan.common.exceptioner.BusinessException. (BusinessException.java:41)
at test.com.tartan.common.exceptioner.TestBusinessException$SimpleBusinessException. (TestBusinessException.java:30)
at test.com.tartan.common.exceptioner.TestBusinessException.testNullMessage(TestBusinessException.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.swingui.TestRunner$16.run(TestRunner.java:623)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:416)
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:525)
... 22 more
Caused by: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log
at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:412)
... 23 more



Can anyone describe me what is the problem? and how can I slove it? Is it something related to JUnit testing framework?



Thanx,
Amir Pashazadeh

   <<Less
About | Sitemap | Contact