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 2017/10/30 15:08:12 UTC

[sling-org-apache-sling-commons-log] branch master updated: SLING-6577 - StringIndexOutOfBoundsException in Sling Log Web Console when creating new logger with absolute file name

This is an automated email from the ASF dual-hosted git repository.

chetanm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-log.git


The following commit(s) were added to refs/heads/master by this push:
     new e87cc83  SLING-6577 - StringIndexOutOfBoundsException in Sling Log Web Console when creating new logger with absolute file name
e87cc83 is described below

commit e87cc833a4a12cd39e7798f98ab5b998374896e5
Author: Chetan Mehrotra <ch...@apache.org>
AuthorDate: Mon Oct 30 20:37:38 2017 +0530

    SLING-6577 - StringIndexOutOfBoundsException in Sling Log Web Console when creating new logger with absolute file name
    
    Use LogWriters from LogConfig as LogWriters by default are used like template. Actual LogWriter are associated with LogConfig
---
 .../sling/commons/log/logback/internal/SlingLogPanel.java      | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/log/logback/internal/SlingLogPanel.java b/src/main/java/org/apache/sling/commons/log/logback/internal/SlingLogPanel.java
index b082a9d..0d6975d 100644
--- a/src/main/java/org/apache/sling/commons/log/logback/internal/SlingLogPanel.java
+++ b/src/main/java/org/apache/sling/commons/log/logback/internal/SlingLogPanel.java
@@ -202,7 +202,7 @@ public class SlingLogPanel implements LogPanel {
 
         final LogConfigManager configManager = logbackManager.getLogConfigManager();
         final String rootPath = logbackManager.getRootDir();
-        final boolean shortenPaths = areAllLogfilesInSameFolder(configManager.getLogWriters(), rootPath);
+        final boolean shortenPaths = areAllLogfilesInSameFolder(configManager.getLogConfigs(), rootPath);
         for (final LogConfig logConfig : configManager.getLogConfigs()) {
             pw.print("<tr id=\"");
             pw.print( XmlUtil.escapeXml(logConfig.getConfigPid()) );
@@ -532,14 +532,14 @@ public class SlingLogPanel implements LogPanel {
     /**
      * Checks if all log files are in the same folder, then the path can displayed shortened in the panel.
      *
-     * @param logWriters list of log writers
+     * @param logConfigs list of log configs
      * @param rootPath   root path
      * @return true if all logfiles are in the same folder
      */
-    private boolean areAllLogfilesInSameFolder(final Iterable<LogWriter> logWriters, final String rootPath) {
+    private boolean areAllLogfilesInSameFolder(final Iterable<LogConfig> logConfigs, final String rootPath) {
         String lastPath = null;
-        for (final LogWriter writer : logWriters) {
-            String path = getPath(writer.getFileName(), null, false);
+        for (final LogConfig config : logConfigs) {
+            String path = getPath(config.getLogWriter().getFileName(), null, false);
             if (!path.startsWith(rootPath)) {
                 return false;
             }

-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].