Author: davsclaus
Date: Sat Aug 27 07:59:23 2011
New Revision: 1162309

URL: http://svn.apache.org/viewvc?rev=1162309&view=rev
Log:
CAMEL-4383: LoggingExceptionHandler logs exception at ERRPR level by default. 
Fixed file component on completion to not attempt logging failed exception, as 
the rollback strategy handles that.

Modified:
    
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/LoggingExceptionHandler.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java?rev=1162309&r1=1162308&r2=1162309&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
 Sat Aug 27 07:59:23 2011
@@ -17,6 +17,7 @@
 package org.apache.camel.component.file;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.LoggingLevel;
 import org.apache.camel.impl.LoggingExceptionHandler;
 import org.apache.camel.spi.ExceptionHandler;
 import org.apache.camel.spi.Synchronization;
@@ -81,12 +82,8 @@ public class GenericFileOnCompletion<T> 
                 // commit the file strategy if there was no failure or already 
handled by the DeadLetterChannel
                 processStrategyCommit(processStrategy, exchange, file);
                 committed = true;
-            } else {
-                if (exchange.getException() != null) {
-                    // if the failure was an exception then handle it
-                    handleException(exchange.getException());
-                }
             }
+            // if we failed, then it will be handled by the rollback in the 
finally block below
         } finally {
             if (!committed) {
                 processStrategyRollback(processStrategy, exchange, file);

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/LoggingExceptionHandler.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/LoggingExceptionHandler.java?rev=1162309&r1=1162308&r2=1162309&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/LoggingExceptionHandler.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/LoggingExceptionHandler.java
 Sat Aug 27 07:59:23 2011
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
  * A default implementation of {@link ExceptionHandler} which uses a {@link 
org.apache.camel.processor.CamelLogger} to
  * log the exception.
  * <p/>
- * This implementation will by default log the exception with stack trace at 
DEBUG level.
+ * This implementation will by default log the exception with stack trace at 
ERROR level.
  *
  * @version 
  */
@@ -36,7 +36,11 @@ public class LoggingExceptionHandler imp
     private final CamelLogger logger;
 
     public LoggingExceptionHandler(Class<?> ownerType) {
-        this(new CamelLogger(LoggerFactory.getLogger(ownerType), 
LoggingLevel.DEBUG));
+        this(new CamelLogger(LoggerFactory.getLogger(ownerType), 
LoggingLevel.ERROR));
+    }
+
+    public LoggingExceptionHandler(Class<?> ownerType, LoggingLevel level) {
+        this(new CamelLogger(LoggerFactory.getLogger(ownerType), level));
     }
 
     public LoggingExceptionHandler(CamelLogger logger) {


Reply via email to