incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amitg...@apache.org
Subject svn commit: r1520970 - /sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/logback/internal/LogbackManager.java
Date Mon, 09 Sep 2013 07:13:25 GMT
Author: amitgupt
Date: Mon Sep  9 07:13:24 2013
New Revision: 1520970

URL: http://svn.apache.org/r1520970
Log:
SLING-3045 - [logback]Warning logs logged for 'No appenders present in context [sling] for
logger'

Thanks Chetan for the patch

Modified:
    sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/logback/internal/LogbackManager.java

Modified: sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/logback/internal/LogbackManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/logback/internal/LogbackManager.java?rev=1520970&r1=1520969&r2=1520970&view=diff
==============================================================================
--- sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/logback/internal/LogbackManager.java
(original)
+++ sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/logback/internal/LogbackManager.java
Mon Sep  9 07:13:24 2013
@@ -11,6 +11,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import ch.qos.logback.classic.Level;
@@ -273,14 +274,15 @@ public class LogbackManager extends Logg
                 + " listeners");
 
             // Attach a console appender to handle logging untill we configure
-            // one. This would be
-            // removed in LogConfigManager.reset
-            getLoggerContext().getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME).addAppender(
-                logConfigManager.getDefaultAppender());
+            // one. This would be removed in LogConfigManager.reset
+            final Logger rootLogger = getLoggerContext().getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
+            rootLogger.addAppender(logConfigManager.getDefaultAppender());
+            rootLogger.setLevel(Level.INFO);
 
             // Now record the time of reset with a default appender attached to
-            // root logger
-            resetStartTime = System.currentTimeMillis();
+            // root logger. We also add a milli second extra to account for logs which would
have
+            // got fired in same duration
+            resetStartTime = System.currentTimeMillis() + TimeUnit.MILLISECONDS.toMillis(1);
 
             context.putObject(LogbackManager.class.getName(), LogbackManager.this);
             for (LogbackResetListener l : resetListeners) {



Mime
View raw message