[slf4j-dev] svn commit: r1084 - slf4j/trunk/slf4j-log4j12/src/main/java/org/slf4j/impl

ceki at slf4j.org ceki at slf4j.org
Thu Jul 31 16:11:18 CEST 2008


Author: ceki
Date: Thu Jul 31 16:11:18 2008
New Revision: 1084

Modified:
   slf4j/trunk/slf4j-log4j12/src/main/java/org/slf4j/impl/Log4jLoggerAdapter.java

Log:
- if(logger.isTraceEnabled()) check in trace(...) methods throw
  a NoMuchMethodException when used with older versions of log4j.
  Replaced with if(isTraceEnabled()) which downgrades to DEBUG for
  older log4j versions.
   
   
   Fixes or re-fixes bug 68 http://bugzilla.slf4j.org/show_bug.cgi?id=68
   

Modified: slf4j/trunk/slf4j-log4j12/src/main/java/org/slf4j/impl/Log4jLoggerAdapter.java
==============================================================================
--- slf4j/trunk/slf4j-log4j12/src/main/java/org/slf4j/impl/Log4jLoggerAdapter.java	(original)
+++ slf4j/trunk/slf4j-log4j12/src/main/java/org/slf4j/impl/Log4jLoggerAdapter.java	Thu Jul 31 16:11:18 2008
@@ -33,12 +33,10 @@
 
 package org.slf4j.impl;
 
-import java.io.ObjectStreamException;
 import java.io.Serializable;
 
 import org.apache.log4j.Level;
 import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.slf4j.Marker;
 import org.slf4j.helpers.MarkerIgnoringBase;
 import org.slf4j.helpers.MessageFormatter;
@@ -133,7 +131,7 @@
    *                the argument
    */
   public void trace(String format, Object arg) {
-    if (logger.isTraceEnabled()) {
+    if (isTraceEnabled()) {
       String msgStr = MessageFormatter.format(format, arg);
       logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, msgStr, null);
     }
@@ -156,7 +154,7 @@
    *                the second argument
    */
   public void trace(String format, Object arg1, Object arg2) {
-    if (logger.isTraceEnabled()) {
+    if (isTraceEnabled()) {
       String msgStr = MessageFormatter.format(format, arg1, arg2);
       logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, msgStr, null);
     }
@@ -177,7 +175,7 @@
    *                an array of arguments
    */
   public void trace(String format, Object[] argArray) {
-    if (logger.isTraceEnabled()) {
+    if (isTraceEnabled()) {
       String msgStr = MessageFormatter.arrayFormat(format, argArray);
       logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, msgStr, null);
     }



More information about the slf4j-dev mailing list