Author: cziegeler
Date: Wed Jun 13 06:06:17 2018
New Revision: 1833438

URL: http://svn.apache.org/viewvc?rev=1833438&view=rev
Log:
FELIX-5866 : scr does not respect the log level set in LoggerAdmin

Modified:
    
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/AbstractLogger.java
    
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/BundleLogger.java
    
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/InternalLogger.java
    
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/R6LogServiceLogger.java
    
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/R7LogServiceLogger.java
    
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/StdOutLogger.java

Modified: 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/AbstractLogger.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/AbstractLogger.java?rev=1833438&r1=1833437&r2=1833438&view=diff
==============================================================================
--- 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/AbstractLogger.java
 (original)
+++ 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/AbstractLogger.java
 Wed Jun 13 06:06:17 2018
@@ -68,8 +68,9 @@ public abstract class AbstractLogger
      */
     public boolean isLogEnabled(final int level)
     {
-        return config.getLogLevel() >= level
-               && getLogger().isLogEnabled(level);
+        final InternalLogger l = getLogger();
+        return (!l.checkScrConfig() || config.getLogLevel() >= level)
+               && l.isLogEnabled(level);
     }
 
     /**

Modified: 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/BundleLogger.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/BundleLogger.java?rev=1833438&r1=1833437&r2=1833438&view=diff
==============================================================================
--- 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/BundleLogger.java
 (original)
+++ 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/BundleLogger.java
 Wed Jun 13 06:06:17 2018
@@ -40,6 +40,10 @@ public class BundleLogger extends LogSer
     {
         return new InternalLogger()
         {
+            @Override
+            public boolean checkScrConfig() {
+                return parent.getLogger().checkScrConfig();
+            }
 
             @Override
             public void log(final int level, final String message, final 
Throwable ex)

Modified: 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/InternalLogger.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/InternalLogger.java?rev=1833438&r1=1833437&r2=1833438&view=diff
==============================================================================
--- 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/InternalLogger.java
 (original)
+++ 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/InternalLogger.java
 Wed Jun 13 06:06:17 2018
@@ -23,4 +23,6 @@ interface InternalLogger {
     void log(int level, String message, Throwable exception);
 
     boolean isLogEnabled(int level);
+
+    boolean checkScrConfig();
 }

Modified: 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/R6LogServiceLogger.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/R6LogServiceLogger.java?rev=1833438&r1=1833437&r2=1833438&view=diff
==============================================================================
--- 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/R6LogServiceLogger.java
 (original)
+++ 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/R6LogServiceLogger.java
 Wed Jun 13 06:06:17 2018
@@ -38,6 +38,11 @@ class R6LogServiceLogger implements Inte
         return true;
     }
 
+    @Override
+    public boolean checkScrConfig() {
+        return true;
+    }
+
     @SuppressWarnings("deprecation")
     @Override
     public void log(final int level, final String message, final Throwable ex)

Modified: 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/R7LogServiceLogger.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/R7LogServiceLogger.java?rev=1833438&r1=1833437&r2=1833438&view=diff
==============================================================================
--- 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/R7LogServiceLogger.java
 (original)
+++ 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/R7LogServiceLogger.java
 Wed Jun 13 06:06:17 2018
@@ -36,6 +36,11 @@ class R7LogServiceLogger implements Inte
     }
 
     @Override
+    public boolean checkScrConfig() {
+        return false;
+    }
+
+    @Override
     public boolean isLogEnabled(final int level)
     {
         switch ( level )

Modified: 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/StdOutLogger.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/StdOutLogger.java?rev=1833438&r1=1833437&r2=1833438&view=diff
==============================================================================
--- 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/StdOutLogger.java
 (original)
+++ 
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/logger/StdOutLogger.java
 Wed Jun 13 06:06:17 2018
@@ -27,6 +27,12 @@ import org.osgi.service.log.LogService;
  */
 class StdOutLogger implements InternalLogger
 {
+
+    @Override
+    public boolean checkScrConfig() {
+        return true;
+    }
+
     @Override
     public void log(final int level, final String message, final Throwable ex)
     {


Reply via email to