title: Multiple error handler in camel
body: <p>I am new in Camel and i try to understand error / exception handling in Apache Camel. I want to do the following:</p>
  
  <ol>
  <li>If any Exception occurs on the route, the original message should be moved to a special "error directory" for analysis reasons.</li>
  <li>If any Exception occurs, additionally the Exception message should be logged / send as mail</li>
  <li>If any Exception occurs, additionally the Exception message should be logged / appended to a logging file </li>
  </ol>
  
  <p>For 1. i used the <code>DeadLetterChannel</code> and saved the message to a folder. This works fine.</p>
  
  <p>For 2. and 3. i wanted to use the <code>LoggingErrorHandler</code> which moves the error exception to a direct route, where i send the mail and append a logging file. But 2. and 3. doesn't work, i get in the <code>log4j</code> file:</p>
  
  <blockquote>
    <p>"ERROR Failed delivery for (MessageId: [...]"</p>
  </blockquote>
  
  <p>Here my routing code:</p>
  
  <pre><code>public void configure() {
      errorHandler(deadLetterChannel("direct:moveFailedMessage").useOriginalMessage());
      from("direct:moveFailedMessage").to(ftpErrorURI+ftpOptions); 
      //.to(sendMailURI); =&gt; this mail works, but here is orig. msg context
  
      from("sql:select * from v_myView?dataSource=myDataSource")
      .bean("orderSqlToJms")
      .to(jmsURI+"?JmsMessageType=Object")
      .bean("validate")
      // this error handler don't work as i expect 
      .errorHandler(loggingErrorHandler("direct:logExceptionToMailAndFile"))
      .to(ftpOutURI+ftpOptions);
  
      from("direct:logExceptionToMailAndFile").to(sendMailURI).to(ftpErrorLogURI+ftpErrorOptions);
  }
  </code></pre>
  
  <p>The mail send works in generell, when i try it in the <code>DeadLetterChannel</code> context, but nothing works in the <code>LoggingErrorHandler</code> context. Is this handler limited to contexts like <code>log4j</code>? If yes, which handler should is use? <code>DefaultErrorHandler</code> routes back to the sender and here is no transaction for <code>TransactionErrorHandler</code>? Can i maybe catch the exception message inside the <code>DeadLetterChannel</code>? I didn't find any hint which could help me, has anyone a solution?</p>
  
  <p>I dont't want to catch all Exeception explicit in a different way, i want to do all the things global for all kind of exceptions. Cause of this i didn't use <code>onException()</code>. Mabye this is wrong?</p>
  
  <p>Why i get a minus for this question? If you leave a comment, i can improve my question.</p>