Enabling step-by-step tracing in code
Camel includes a Tracer interceptor that makes it very easy to enable step-by-step logging of the message. This interceptor will log the current state of the message, and information about the processing step within your route in which the message is located.
This recipe will show you how to enable and configure Camel's Tracer.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.monitoring.trace
package. The Spring XML files are located under src/main/resources/META-INF/spring
and prefixed with trace
.
How to do it...
In the XML DSL, set the trace
attribute of the camelContext
element to true
:
<camelContext trace="true"
xmlns="http://camel.apache.org/schema/spring">
In the Java DSL, fetch the associated Camel context, and set its tracing
property to true
:
public class TraceRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
getContext().setTracing...