Redirecting Caught and Uncaught Exceptions to OSGI Console and Log File
[controller.git] / opendaylight / logging / bridge / src / main / java / org / opendaylight / controller / logging / bridge / internal / UncaughtExceptionHandler.java
diff --git a/opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/UncaughtExceptionHandler.java b/opendaylight/logging/bridge/src/main/java/org/opendaylight/controller/logging/bridge/internal/UncaughtExceptionHandler.java
new file mode 100644 (file)
index 0000000..6fe9c44
--- /dev/null
@@ -0,0 +1,13 @@
+package org.opendaylight.controller.logging.bridge.internal;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class UncaughtExceptionHandler implements Thread.UncaughtExceptionHandler{
+        private static Logger log = LoggerFactory.getLogger(UncaughtExceptionHandler.class);
+
+        public void uncaughtException (Thread t, Throwable e) {
+                log.error("Uncaught ExceptionHandler:", e);
+        }
+}