cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1301710 - /cxf/trunk/api/src/main/java/org/apache/cxf/common/logging/LogUtils.java
Date Fri, 16 Mar 2012 19:16:18 GMT
Author: dkulp
Date: Fri Mar 16 19:16:17 2012
New Revision: 1301710

URL: http://svn.apache.org/viewvc?rev=1301710&view=rev
Log:
Revert "CXF-4180 LogUtils should default to CXF's Slf4jLogger if it can't find Log4J or JCL
driver"
Need to revert so the unit tests will run to test other changes.

This reverts commit d164ba6a68a2cdfba110064c687ac32707029772.

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=1301710&r1=1301709&r2=1301710&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 19:16:17
2012
@@ -97,8 +97,17 @@ public final class LogUtils {
             }
             if (StringUtils.isEmpty(cname)) {
                 Class.forName("org.slf4j.impl.StaticLoggerBinder");
-                // using the Slf4jLogger directly
-                cname = "org.apache.cxf.common.logging.Slf4jLogger";
+                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";
+                    }
+                }
             }
             if (!StringUtils.isEmpty(cname)) {
                 try {



Mime
View raw message