cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1301539 - /cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java
Date Fri, 16 Mar 2012 14:18:01 GMT
Author: ningjiang
Date: Fri Mar 16 14:18:01 2012
New Revision: 1301539

URL: http://svn.apache.org/viewvc?rev=1301539&view=rev
Log:
CXF-4180 LogUtils should default to CXF's Slf4jLogger if it can't find Log4J or JCL driver

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java?rev=1301539&r1=1301538&r2=1301539&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java Fri Mar 16 14:18:01
2012
@@ -35,6 +35,7 @@ import java.util.logging.Logger;
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.log4j.spi.LoggerFactory;
 
 
 /**
@@ -97,17 +98,8 @@ public final class LogUtils {
             }
             if (StringUtils.isEmpty(cname)) {
                 Class.forName("org.slf4j.impl.StaticLoggerBinder");
-                Class<?> cls = Class.forName("org.slf4j.LoggerFactory");
-                Class<?> fcls = cls.getMethod("getILoggerFactory").invoke(null).getClass();
-                if (fcls.getName().contains("Log4j")) {
-                    cname = "org.apache.cxf.common.logging.Log4jLogger";
-                } else if (fcls.getName().contains("JCL")) {
-                    cls = Class.forName("org.apache.commons.logging.LogFactory");
-                    fcls = cls.getMethod("getFactory").invoke(null).getClass();
-                    if (fcls.getName().contains("Log4j")) {
-                        cname = "org.apache.cxf.common.logging.Log4jLogger";
-                    }
-                }
+                // using the Slf4jLogger directly
+                cname = "org.apache.cxf.common.logging.Slf4jLogger";
             }
             if (!StringUtils.isEmpty(cname)) {
                 try {



Mime
View raw message