activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1207527 - in /activemq/activemq-apollo/trunk: apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala apollo-util/src/main/scala/org/apache/activemq/apollo/util/Logging.scala pom.xml
Date Mon, 28 Nov 2011 19:20:07 GMT
Author: chirino
Date: Mon Nov 28 19:20:06 2011
New Revision: 1207527

URL: http://svn.apache.org/viewvc?rev=1207527&view=rev
Log:
Fixes APLO-89: Uncaught Exceptions are not being properly logged.

Modified:
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
    activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Logging.scala
    activemq/activemq-apollo/trunk/pom.xml

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala?rev=1207527&r1=1207526&r2=1207527&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
Mon Nov 28 19:20:06 2011
@@ -28,6 +28,8 @@ import java.io.{FileInputStream, File}
 import java.util.logging.LogManager
 import org.apache.activemq.apollo.dto.BrokerDTO
 import collection.mutable.ListBuffer
+import java.lang.Thread.UncaughtExceptionHandler
+import java.lang.Throwable
 
 /**
  * The apollo run command
@@ -51,6 +53,16 @@ class Run extends Action {
 
     try {
 
+      // 
+      // Install an UncaughtExceptionHandler so that all exceptions get properly logged.
+      val exception_handler = new UncaughtExceptionHandler {
+        def uncaughtException(t: Thread, error: Throwable) {
+          Broker.warn(error)
+        }
+      }
+      Thread.setDefaultUncaughtExceptionHandler(exception_handler)
+      getGlobalQueue().sync(Thread.currentThread().setUncaughtExceptionHandler(exception_handler))
+      
       val base = system_dir("apollo.base")
       val etc: File = base / "etc"
 
@@ -96,7 +108,7 @@ class Run extends Action {
           Broker.warn("")
         }
       }
-
+      
       if( broker.config.validation == "strict" && !validation_messages.isEmpty) {
         Broker.error("Strict validation was configured, shutting down")
         return null
@@ -124,7 +136,7 @@ class Run extends Action {
       } else {
         null
       }
-
+      
       if(jul_config_monitor!=null) jul_config_monitor.start
       log4j_config_monitor.start
       broker_config_monitor.start

Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Logging.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Logging.scala?rev=1207527&r1=1207526&r2=1207527&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Logging.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Logging.scala
Mon Nov 28 19:20:06 2011
@@ -113,7 +113,7 @@ trait Log {
   def warn(e: Throwable): Unit = {
     with_throwable(e) {
       if( log.isWarnEnabled ) {
-        log.warn(e.getMessage)
+        log.warn(e.toString)
       }
     }
   }
@@ -135,7 +135,7 @@ trait Log {
   def info(e: Throwable): Unit = {
     with_throwable(e) {
       if( log.isInfoEnabled ) {
-        log.info(e.getMessage)
+        log.info(e.toString)
       }
     }
   }
@@ -155,7 +155,7 @@ trait Log {
 
   def debug(e: Throwable): Unit = {
     if( log.isDebugEnabled ) {
-      log.debug(e.getMessage, e)
+      log.debug(e.toString, e)
     }
   }
 
@@ -173,7 +173,7 @@ trait Log {
 
   def trace(e: Throwable): Unit = {
     if( log.isTraceEnabled ) {
-      log.trace(e.getMessage, e)
+      log.trace(e.toString, e)
     }
   }
 

Modified: activemq/activemq-apollo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1207527&r1=1207526&r2=1207527&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Mon Nov 28 19:20:06 2011
@@ -96,7 +96,7 @@
     <xbean-version>3.4</xbean-version>
     <felix-version>1.0.0</felix-version>
 
-    <hawtdispatch-version>1.4</hawtdispatch-version>
+    <hawtdispatch-version>1.5-SNAPSHOT</hawtdispatch-version>
     <hawtbuf-version>1.6</hawtbuf-version>
     
     <jdbm-version>2.0.1</jdbm-version>



Mime
View raw message