You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2012/03/16 17:17:12 UTC

svn commit: r1301627 - in /cxf/branches/2.5.x-fixes: ./ common/common/src/main/java/org/apache/cxf/common/logging/LogUtils.java

Author: ningjiang
Date: Fri Mar 16 16:17:11 2012
New Revision: 1301627

URL: http://svn.apache.org/viewvc?rev=1301627&view=rev
Log:
CXF-4180 revert the patch which has some side effects

Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/logging/LogUtils.java

Propchange: cxf/branches/2.5.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/logging/LogUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/logging/LogUtils.java?rev=1301627&r1=1301626&r2=1301627&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/logging/LogUtils.java (original)
+++ cxf/branches/2.5.x-fixes/common/common/src/main/java/org/apache/cxf/common/logging/LogUtils.java Fri Mar 16 16:17:11 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 {