camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Minh Tran <darth.minhs...@gmail.com>
Subject Re: How to log a Processor ERROR with stacktrace using DeadLetterChannel?
Date Mon, 18 Apr 2016 00:22:27 GMT
Hi

It’s easier to just define a redelivery policy profile and tell it what you want to log
on exhausted. There are stacks of options you can set on it to customise it to exactly what
you want to log.

See here for an example

http://camel.apache.org/redeliverypolicy.html <http://camel.apache.org/redeliverypolicy.html>

> On 18 Apr 2016, at 9:56 AM, jimi.hullegard@svensktnaringsliv.se wrote:
> 
> Hi,
> 
> 
> 
> How can I log a Processor ERROR with stacktrace using DeadLetterChannel? Ie I have a
route with a Processor that throws an Exception of some kind, and the route has a DeadLetterChannel
configured, that sends the exchange to a "error" route. And I would like this Exception to
be logged on ERROR level, with stacktrace.
> 
> 
> 
> My setup, using Camel 2.17.0 and Camel Spring xml, looks something like this:
> 
> 
> 
> <errorHandler id="deadLetterErrorHandler" type="DeadLetterChannel" deadLetterUri="direct:error"
/>
> 
> 
> 
> <camelContext>
> <route errorHandlerRef="deadLetterErrorHandler">
>  [...]
>  <process ref="myProcessor" /><!-- This throws an exception in method process(Exchange)
-->
>  [...]
> </route>
> 
> <route>
>  <from uri="direct:error" />
> 
>  <log logName="com.mycompany" loggingLevel="ERROR" message="Could not handle file
'${file:name}'" />
> 
>  <to uri="log:com.mycompany?level=ERROR&amp;showException=true&amp;showCaughtException=true&amp;showStackTrace=true"
/>
> 
>  [...]
> </route>
> <camelContext>
> 
> 
> The expected behaivor is that Camel logs the exception on ERROR logging level, with stacktrace.
The actual behaivor is that Camel logs the exception like this:
> 
> 
> 
> [...] DEBUG org.apache.camel.processor.DeadLetterChannel - Failed delivery for (MessageId:
12345 on ExchangeId: 54321). On delivery attempt: 0 caught: java.lang.IllegalArgumentException:
Exception details...
> 
> 
> 
> Ie it logs the exception on DEBUG log level, and without any stacktrace.
> 
> 
> 
> What can I do to fix this?
> 
> 
> 
> Regards
> /Jimi


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message