You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2018/06/12 16:14:37 UTC

svn commit: r1833407 - /felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/LogServiceSupport.java

Author: cziegeler
Date: Tue Jun 12 16:14:36 2018
New Revision: 1833407

URL: http://svn.apache.org/viewvc?rev=1833407&view=rev
Log:
FELIX-5865 : SCR r7 logging support doesn't work on equinox framework

Modified:
    felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/LogServiceSupport.java

Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/LogServiceSupport.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/LogServiceSupport.java?rev=1833407&r1=1833406&r2=1833407&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/LogServiceSupport.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/LogServiceSupport.java Tue Jun 12 16:14:36 2018
@@ -34,11 +34,32 @@ class LogServiceSupport
 
     private final Bundle bundle;
 
+    private static boolean checkForLoggerFactory(Class<?> clazz)
+    {
+        while ( clazz != null )
+        {
+            final Class<?>[] is = clazz.getInterfaces();
+            for(final Class<?> c : is)
+            {
+                if ( "org.osgi.service.log.LoggerFactory".equals(c.getName()) )
+                {
+                    return true;
+                }
+                if ( checkForLoggerFactory(c) )
+                {
+                    return true;
+                }
+            }
+            clazz = clazz.getSuperclass();
+        }
+        return false;
+    }
+
     public LogServiceSupport(final Bundle bundle, final Object logService)
     {
         this.logService = (LogService) logService;
         this.bundle = bundle;
-        this.r7Enabled = "org.osgi.service.log.LoggerFactory".equals(this.logService.getClass().getSuperclass().getName());
+        this.r7Enabled = checkForLoggerFactory(this.logService.getClass());
     }
 
     InternalLogger getLogger()