[slf4j-dev] log4j 1.2 and 1.3 compatibility issues [WAS: Release of SLF4J 1.0beta9]

Ceki Gülcü listid at qos.ch
Mon Nov 21 18:29:31 CET 2005


At 09:41 PM 10/19/2005, Jacob Kjome wrote:

>No, I'm talking about running LogWeb against Log4j-1.3 at runtime, not 
>compiling
>LogWeb against 1.3.  LogWeb was compiled against 1.2.xx and run against 1.3.
>I'm not saying this is the end-all-be-all test of runtime compatibility, 
>but it
>does seem to work against an application, LogWeb, that hits a lot of Log4j's
>api.
>
>I suggest you either wait for Mark to cut a new alpha (I think he said he was
>going to do it tonight or, at least, very soon) or build it yourself and 
>verify
>whether my statements are correct.

Jacob,

Just to let you know that running tests against Mark's 1.3alpha-7 release 
fail exactly in the same way as 1.3alpha6 did previously. To try out this 
for your self, you can download SLF4J 1.0RC1 and place log4j-1.3alpha7.jar 
under $SLF4J_HOME/lib/. You should also place log4j-1.2.9.jar under 
$SLF4J_HOME/lib/.

Alternatively, you can check out 
from  'http://svn.slf4j.org/repos/slf4j/trunk'
Here are the set of command you can run:

# cd some_directory
# svn co http://svn.slf4j.org/repos/slf4j/trunk slf4j
# cd slf4j
# ant jar
# cd tests
# ant all  (this runs all tests known to work correctly)

Running the following two tests will results in errors.

# ant CompatibilityA

this will fail with

    [junit] Testcase: test1 took 0.07 sec
    [junit]     Caused an ERROR
    [junit] 
org.apache.log4j.Logger.log(Ljava/lang/String;Lorg/apache/log4j/Level;Ljava/lang/Object;Ljava/lang/Throwable;)V
    [junit] java.lang.NoSuchMethodError: 
org.apache.log4j.Logger.log(Ljava/lang/String;Lorg/apache/log4j/Level;Ljava/lang/Object;Ljava/lang/Throwable;)V
    [junit]     at 
org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:84)
    [junit]     at org.slf4j.InvokingSLF4J.test1(InvokingSLF4J.java:67)

# ant CompatibilityB

     [junit] Testcase: test1 took 0.07 sec
     [junit]     Caused an ERROR
     [junit] (class: org/slf4j/impl/Log4jLoggerAdapter, method: 
isErrorEnabled signature: ()Z) Incompatible argument to function
     [junit] java.lang.VerifyError: (class: 
org/slf4j/impl/Log4jLoggerAdapter, method: isErrorEnabled signature: ()Z) 
Incompatible argument to function
     [junit]     at 
org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:65)
     [junit]     at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:87)
     [junit]     at org.slf4j.InvokingSLF4J.test1(InvokingSLF4J.java:66)


Tests CompatibilityA and CompatibilityB check whether slf4j-log4j13.jar 
compiled against 1.3 can run against log4j 1.2 and respectively 
slf4j-log4j12.jar compiled against 1.2 can run against log4j 1.3. In both 
cases and as far as my tests attest, the answer seems to be negative.

I hope this helps,

>Jake

-- 
Ceki Gülcü

   The complete log4j manual: http://www.qos.ch/log4j/
   Improve your Sudoku skills at http://www.sudoku-grok.com/





More information about the slf4j-dev mailing list