Logging Bridge need to show the source of the OSGi Log events 26/826/1
authorGiovanni Meo <gmeo@cisco.com>
Thu, 8 Aug 2013 09:25:40 +0000 (11:25 +0200)
committerGiovanni Meo <gmeo@cisco.com>
Thu, 8 Aug 2013 09:25:40 +0000 (11:25 +0200)
Logging bridge is in charge of bridging the OSGi log events toward
SLF4J but even when it does, like because an Apache Dependency Manager
callback didn't complete, it doesn't give the information on who is
the culprit and why, making debugging more difficult, this enhace the
logging.

Change-Id: I388516b3bc40d94552f49d6928b3b33c8349b687
Signed-off-by: Giovanni Meo <gmeo@cisco.com>
opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/LogListenerImpl.java

index d3c72b9..03719d5 100644 (file)
@@ -26,16 +26,20 @@ public class LogListenerImpl implements LogListener {
         if (this.logger != null) {
             switch (entry.getLevel()) {
             case LogService.LOG_DEBUG:
-                this.logger.debug(entry.getMessage());
+                this.logger.debug("Bundle:{} Message:{} Exception:{}", entry.getBundle()
+                        .getSymbolicName(), entry.getMessage(), entry.getException());
                 break;
             case LogService.LOG_INFO:
-                this.logger.info(entry.getMessage());
+                this.logger.info("Bundle:{} Message:{} Exception:{}", entry.getBundle()
+                        .getSymbolicName(), entry.getMessage(), entry.getException());
                 break;
             case LogService.LOG_WARNING:
-                this.logger.warn(entry.getMessage());
+                this.logger.warn("Bundle:{} Message:{} Exception:{}", entry.getBundle()
+                        .getSymbolicName(), entry.getMessage(), entry.getException());
                 break;
             case LogService.LOG_ERROR:
-                this.logger.error(entry.getMessage());
+                this.logger.error("Bundle:{} Message:{} Exception:{}", entry.getBundle()
+                        .getSymbolicName(), entry.getMessage(), entry.getException());
                 break;
             }
         }