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 / Activator.java
index 90908ef7fa96fcda1d95bec7afae8d52f89ffdb6..75c5ca9cbbbbd13cf050975a9cffcd4e916a4ad9 100644 (file)
@@ -55,6 +55,15 @@ public class Activator implements BundleActivator {
                         this.listener.logged(entry);
                     }
                 }
+                
+                /*
+                 * Install the default exception handler so that the uncaught
+                 * exceptions are handled by our customized handler. This new
+                 * handler will display the exceptions to OSGI console as well
+                 * as log to file.
+                 */
+                Thread.setDefaultUncaughtExceptionHandler(new org.opendaylight.
+                        controller.logging.bridge.internal.UncaughtExceptionHandler());
             } else {
                 this.log.error("Cannot register the LogListener because "
                         + "cannot retrive LogReaderService");