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&showException=true&showCaughtException=true&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