Author: davsclaus
Date: Wed Jun 29 13:33:21 2011
New Revision: 1141096

URL: http://svn.apache.org/viewvc?rev=1141096&view=rev
Log:
CAMEL-4041: More detailed message logged when fatal fallback error handler 
handles unhandled exceptions.

Modified:
    
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FatalFallbackErrorHandler.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FatalFallbackErrorHandler.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FatalFallbackErrorHandler.java?rev=1141096&r1=1141095&r2=1141096&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FatalFallbackErrorHandler.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/FatalFallbackErrorHandler.java
 Wed Jun 29 13:33:21 2011
@@ -44,10 +44,19 @@ public class FatalFallbackErrorHandler e
                 if (exchange.getException() != null) {
                     // an exception occurred during processing onException
 
-                    // log a warning
-                    LOG.error("Exception occurred while processing exchangeId: 
" + exchange.getExchangeId()
-                            + " using: [" + processor + "] caused by: "
-                            + exchange.getException().getMessage(), 
exchange.getException());
+                    // log detailed error message with as much detail as 
possible
+                    Throwable previous = 
exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
+                    String msg = "Exception occurred while trying to handle 
previously thrown exception on exchangeId: "
+                            + exchange.getExchangeId() + " using: [" + 
processor + "].";
+                    if (previous != null) {
+                        msg += " The previous and the new exception will be 
logged in the following.";
+                        LOG.error(msg);
+                        LOG.error("\\--> Previous exception on exchangeId: " + 
exchange.getExchangeId() , previous);
+                        LOG.error("\\--> New exception on exchangeId: " + 
exchange.getExchangeId(), exchange.getException());
+                    } else {
+                        LOG.error(msg);
+                        LOG.error("\\--> New exception on exchangeId: " + 
exchange.getExchangeId(), exchange.getException());
+                    }
 
                     // we can propagated that exception to the caught property 
on the exchange
                     // which will shadow any previously caught exception and 
cause this new exception


Reply via email to