Redirecting Caught and Uncaught Exceptions to OSGI Console and Log File
[controller.git] / opendaylight / clustering / services_implementation / src / main / java / org / opendaylight / controller / clustering / services_implementation / internal / ClusterManager.java
index 058c616ad87b281b2d7d3420fcb98cdb28f6ffa1..476b1b12f55370acaf22465f31378ad67a21bb6f 100644 (file)
@@ -243,10 +243,8 @@ public class ClusterManager implements IClusterServices {
             } catch (Exception e) {
                 logger.error("GossipRouter didn't start exception " + e
                         + " met");
-                StringWriter sw = new StringWriter();
                 logger.error("Stack Trace that raised the exception");
-                e.printStackTrace(new PrintWriter(sw));
-                logger.error(sw.toString());
+                logger.error("",e);
             }
         }
         logger.info("Starting the ClusterManager");
@@ -260,11 +258,9 @@ public class ClusterManager implements IClusterServices {
                 logger.debug("Started the ClusterManager");
             }
         } catch (Exception ioe) {
-            StringWriter sw = new StringWriter();
             logger.error("Cannot configure infinispan .. bailing out ");
             logger.error("Stack Trace that raised th exception");
-            ioe.printStackTrace(new PrintWriter(sw));
-            logger.error(sw.toString());
+            logger.error("",ioe);
             this.cm = null;
             this.stop();
         }