// before
if (shouldLog) {
// register route path taken if TraceableUnitOfWork unit of work
if (exchange.getUnitOfWork() instanceof TraceableUnitOfWork) {
TraceableUnitOfWork tuow = (TraceableUnitOfWork) exchange.getUnitOfWork();
if (node instanceof OnExceptionDefinition) {
// special for on exception so we can see it in the trace logs
trace = beforeOnException((OnExceptionDefinition) node, tuow, exchange);
} else if (node instanceof OnCompletionDefinition) {
// special for on completion so we can see it in the trace logs
trace = beforeOnCompletion((OnCompletionDefinition) node, tuow, exchange);
} else {
// regular so just add it
tuow.addTraced(new DefaultRouteNode(node, super.getProcessor()));
}
}
}
// log and trace the processor
if (trace) {
logExchange(exchange);
traceExchange(exchange);
}
// some nodes need extra work to trace it
if (exchange.getUnitOfWork() instanceof TraceableUnitOfWork) {
TraceableUnitOfWork tuow = (TraceableUnitOfWork) exchange.getUnitOfWork();
if (node instanceof InterceptDefinition) {
// special for intercept() as we would like to trace the processor that was intercepted
// as well, otherwise we only see the intercepted route, but we need the both to be logged/traced
afterIntercept((InterceptDefinition) node, tuow, exchange);