servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1207773 - /servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JCLLogger.java
Date Tue, 29 Nov 2011 07:34:13 GMT
Author: ffang
Date: Tue Nov 29 07:34:12 2011
New Revision: 1207773

URL: http://svn.apache.org/viewvc?rev=1207773&view=rev
Log:
[SMXCOMP-916]org.apache.servicemix.http.jetty.JCLLogger can't get initialized in OSGi container

Modified:
    servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JCLLogger.java

Modified: servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JCLLogger.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JCLLogger.java?rev=1207773&r1=1207772&r2=1207773&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JCLLogger.java
(original)
+++ servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/jetty/JCLLogger.java
Tue Nov 29 07:34:12 2011
@@ -44,10 +44,12 @@ public class JCLLogger implements Logger
     public static void init() {
         // TODO: use org.mortbay.log.Log#setLog when available (beta18)
         String old = System.getProperty("org.mortbay.log.class");
+        ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
         try {
             System.setProperty("org.mortbay.log.class", JCLLogger.class.getName());
             // For the class to be loaded by invoking a public static method
             Class<?> cl = Logger.class.getClassLoader().loadClass("org.mortbay.log.Log");
+            Thread.currentThread().setContextClassLoader(JCLLogger.class.getClassLoader());
             cl.getMethod("isDebugEnabled", new Class[0]).invoke(null);
         } catch (Exception e) {
             e.printStackTrace();
@@ -57,6 +59,7 @@ public class JCLLogger implements Logger
             } else {
                 System.getProperties().remove("org.mortbay.log.class");
             }
+            Thread.currentThread().setContextClassLoader(oldLoader);
         }
     }
     



Mime
View raw message