You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ch...@apache.org on 2015/01/04 16:41:55 UTC

svn commit: r1649350 - /sling/trunk/bundles/commons/log/src/main/java/org/apache/sling/commons/log/logback/internal/LogbackManager.java

Author: chetanm
Date: Sun Jan  4 15:41:55 2015
New Revision: 1649350

URL: http://svn.apache.org/r1649350
Log:
SLING-4225 - The root directory for Sling logging should be configurable explicitly

Applying the patch from Jorg Hoh. Thanks!

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=1649350&r1=1649349&r2=1649350&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 Sun Jan  4 15:41:55 2015
@@ -74,6 +74,11 @@ public class LogbackManager extends Logg
 
     private static final String RESET_EVENT_TOPIC = "org/apache/sling/commons/log/RESET";
 
+    /**
+     * Framework property specifying the root location used to resolve relative paths
+     */
+    private static final String SLING_LOG_ROOT = "sling.log.root";
+
     private final BundleContext bundleContext;
 
     private final String rootDir;
@@ -357,9 +362,12 @@ public class LogbackManager extends Logg
     }
 
     private String getRootDir(BundleContext bundleContext) {
-        String rootDir = bundleContext.getProperty("sling.home");
+        String rootDir = bundleContext.getProperty(SLING_LOG_ROOT);
         if (rootDir == null) {
-            rootDir = new File(".").getAbsolutePath();
+            rootDir = bundleContext.getProperty("sling.home");
+            if (rootDir == null) {
+                rootDir = new File(".").getAbsolutePath();
+            }
         }
         addInfo("Using rootDir as " + rootDir);
         return rootDir;