How to fully log the exception callstack of an exception in Camel that is handled in a Camel onException() policy?
Issue
Lets assume we have the following Camel exception handling defined in Java DSL:
@Override
public void configure() throws Exception {
onException(Exception.class)
.handled(true)
.markRollbackOnly()
.useOriginalMessage()
.logStackTrace(true);
from("direct:throw-exception-with-handler")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
throw new RuntimeException("show me some stack");
}
});
}
When calling route direct:throw-exception-with-handler
at runtime the onException policy does indeed handle the exception but it does not log the full call stack of the exception.
If we remove the call to .handled(true)
, then the full exception call stack gets logged.
How can we use .handled(true)
and still log the full exception call stack in Camel?
Environment
- JBoss Fuse 6.3.
- Camel 2.17
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.