karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject karaf git commit: KARAF-4500 - Refresh of the pax-logging-service cause log:* commands errors
Date Tue, 23 Aug 2016 15:33:22 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-4.0.x 1895733f4 -> b9ab92d8d


KARAF-4500 - Refresh of the pax-logging-service cause log:* commands errors

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/b9ab92d8
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/b9ab92d8
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/b9ab92d8

Branch: refs/heads/karaf-4.0.x
Commit: b9ab92d8d9be0ba3fadfadc8ef755ce2f92031d4
Parents: 1895733
Author: Guillaume Nodet <gnodet@apache.org>
Authored: Tue Aug 23 17:33:10 2016 +0200
Committer: Guillaume Nodet <gnodet@apache.org>
Committed: Tue Aug 23 17:33:10 2016 +0200

----------------------------------------------------------------------
 .../apache/karaf/log/command/DisplayLog.java    | 28 ++++++++++++--------
 .../org/apache/karaf/log/command/LogTail.java   |  7 +----
 2 files changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/b9ab92d8/log/src/main/java/org/apache/karaf/log/command/DisplayLog.java
----------------------------------------------------------------------
diff --git a/log/src/main/java/org/apache/karaf/log/command/DisplayLog.java b/log/src/main/java/org/apache/karaf/log/command/DisplayLog.java
index e196485..545637f 100644
--- a/log/src/main/java/org/apache/karaf/log/command/DisplayLog.java
+++ b/log/src/main/java/org/apache/karaf/log/command/DisplayLog.java
@@ -82,10 +82,7 @@ public class DisplayLog implements Action {
 
         Iterable<PaxLoggingEvent> le = logService.getEvents(entries == 0 ? Integer.MAX_VALUE
: entries);
         for (PaxLoggingEvent event : le) {
-            int sl = event.getLevel().getSyslogEquivalent();
-            if (sl <= minLevel) {
-                printEvent(out, event);
-            }
+            printEvent(out, event, minLevel);
         }
         out.println();
         return null;
@@ -95,14 +92,13 @@ public class DisplayLog implements Action {
     	return event.getLoggerName().contains(logger);
     }
 
-    protected void printEvent(final PrintStream out, PaxLoggingEvent event) {
+    protected void printEvent(PrintStream out, PaxLoggingEvent event, int minLevel) {
         try {
-            if ((logger != null) &&
-                    (event != null) &&
-                    (checkIfFromRequestedLog(event))) {
-                out.append(formatter.format(event, overridenPattern, noColor));
-            } else if ((event != null) && (logger == null)) {
-                out.append(formatter.format(event, overridenPattern, noColor));
+            if (event != null) {
+                int sl = event.getLevel().getSyslogEquivalent();
+                if (sl <= minLevel) {
+                    printEvent(out, event);
+                }
             }
         } catch (NoClassDefFoundError e) {
             // KARAF-3350: Ignore NoClassDefFoundError exceptions
@@ -110,4 +106,14 @@ public class DisplayLog implements Action {
             // bundle has been refreshed somehow.
         }
     }
+
+    protected void printEvent(final PrintStream out, PaxLoggingEvent event) {
+        if ((logger != null) &&
+                (event != null) &&
+                (checkIfFromRequestedLog(event))) {
+            out.append(formatter.format(event, overridenPattern, noColor));
+        } else if ((event != null) && (logger == null)) {
+            out.append(formatter.format(event, overridenPattern, noColor));
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b9ab92d8/log/src/main/java/org/apache/karaf/log/command/LogTail.java
----------------------------------------------------------------------
diff --git a/log/src/main/java/org/apache/karaf/log/command/LogTail.java b/log/src/main/java/org/apache/karaf/log/command/LogTail.java
index aa82227..5a2810f 100644
--- a/log/src/main/java/org/apache/karaf/log/command/LogTail.java
+++ b/log/src/main/java/org/apache/karaf/log/command/LogTail.java
@@ -106,12 +106,7 @@ public class LogTail extends DisplayLog {
             }
             Iterable<PaxLoggingEvent> le = logService.getEvents(entries == 0 ? Integer.MAX_VALUE
: entries);
             for (PaxLoggingEvent event : le) {
-                if (event != null) {
-                    int sl = event.getLevel().getSyslogEquivalent();
-                    if (sl <= minLevel) {
-                        printEvent(out, event);
-                    }
-                }
+                printEvent(out, event, minLevel);
             }
             // Tail
             final BlockingQueue<PaxLoggingEvent> queue = new LinkedBlockingQueue<PaxLoggingEvent>();


Mime
View raw message