...
From Camel 2.12 onwards you must explicit enable tracing on CamelContext to use it. In XML DSL you do this by setting <camelContext trace="true" ...>
and in Java you do camelContext.setTracing(true)
.
Options
Div |
---|
class | confluenceTableSmall |
---|
|
Wiki Markup |
---|
{div:class=confluenceTableSmall}
|| Option || Default || Description ||
| formatter | | Sets the Trace Formatter to use. Will default use {{ Option | Default | Description |
---|
formatter | | Sets the Trace Formatter to use. Will default use |
org.apache.camel.processor.interceptor.DefaultTraceFormatter
|
}}. |
| enabled | true | Flag to enable or disable this tracer |
| logLevel | {{INFO}} | The logging level to use: FATAL, ERROR, WARN, INFO, DEBUG, TRACE, OFF |
| logName | | The log name to use. Will default use {{. | enabled | true | Flag to enable or disable this tracer | logLevel | INFO | The logging level to use: FATAL, ERROR, WARN, INFO, DEBUG, TRACE, OFF | logName | | The log name to use. Will default use org.apache.camel.processor.interceptor.TraceInterceptor |
}}
| traceFilter | null | An exchange [Predicate] to filter the tracing. |
| traceInterceptors | false | Flag to enable or disable tracing of interceptors |
| traceExceptions | true| Flag to enable or disable tracing of thrown exception during processing of the exchange |
| traceOutExchanges | false | Flag to enable fine grained tracing with a callback for both IN (before) and OUT (after). Is disabled by default which means there is only one trace callback executed. |
| logStackTrace | false | When tracing exception you can control whether the stack trace should be logged also. If *not* then only the exception class and message is logged. |
| useJpa | false | To use a {{JpaTraceEventMessage}} from *camel-jpa* component as the {{TraceEventMessage}}. This requires that *camel-jpa.jar* is on the classpath. |
| destinationUri | null | Optional destination uri to route [TraceEventExchange|http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/interceptor/TraceEventExchange.html] containing [TraceEventMessage|http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/interceptor/TraceEventMessage.html] with details about the trace. Can be used for custom processing to store traces in database using [JPA]. |
| jpaTraceEventMessageClassName | null | *Camel 2.3:* Fully class name for a custom {{ | traceFilter | null | An exchange Predicate to filter the tracing. | traceInterceptors | false | Flag to enable or disable tracing of interceptors | traceExceptions | true | Flag to enable or disable tracing of thrown exception during processing of the exchange | traceOutExchanges | false | Flag to enable fine grained tracing with a callback for both IN (before) and OUT (after). Is disabled by default which means there is only one trace callback executed. | logStackTrace | false | When tracing exception you can control whether the stack trace should be logged also. If not then only the exception class and message is logged. | useJpa | false | To use a JpaTraceEventMessage from camel-jpa component as the TraceEventMessage . This requires that camel-jpa.jar is on the classpath. | destinationUri | null | Optional destination uri to route TraceEventExchange containing TraceEventMessage with details about the trace. Can be used for custom processing to store traces in database using JPA. | jpaTraceEventMessageClassName | null | Camel 2.3: Fully class name for a custom org.apache.camel.processor.interceptor.TraceEventMessage |
}} |
| traceHandler | null | *Camel | traceHandler | null | Camel 2.3: |
* {{org.apache.camel.processor.interceptor.TraceEventHandler
|
}} |
| traceInterceptorFactory | null | *Camel | traceInterceptorFactory | null | Camel 2.3: |
* {{org.apache.camel.processor.interceptor.TraceInterceptorFactory
|
}} {{}} {{org.apache.camel.processor.interceptor.TraceInterceptor
|
}} |
{div} |
Formatting
The tracer formats the execution of exchanges to log lines. They are logged at INFO level in the log category: org.apache.camel.processor.interceptor.TraceInterceptor
.
The tracer uses by default the org.apache.camel.processor.interceptor.DefaultTraceFormatter
to format the log line.
DefaultTraceFormatter
has the following options:
Div |
---|
class | confluenceTableSmall |
---|
|
Option | Default | Description |
---|
breadCrumbLength | 0 | Fixed length of the bread crumb. 0 = no fixed length. Setting a value to e.g. 80 allows the tracer logs to be aligned for easier reading. | nodeLength | 0 | Fixed length of the node. 0 = no fixed length. Setting a value to e.g. 40 allows the tracer logs to be aligned for easier reading. | showBreadCrumb | true | Outputs the unique unit of work for the exchange. To be used for correlation so you can identify the same exchange. | showNode | true | Previous and destination node, so you can see from -> to. | showExchangeId | false | To output the unique exchange id. Currently the breadcrumb is sufficient. | showShortExchangeId | false | To output the unique exchange id in short form, without the hostname. | showProperties | false | Output the exchange properties | showHeaders | true | Output the in message headers | showBodyType | true | Output the in body Java type | showBody | true | Output the in body | showOutHeaders | false | Output the out (if any) message headers | showOutBodyType | false | Output the out (if any) body Java type | showOutBody | false | Output the out (if any) body | showExchangePattern | true | Output the exchange pattern | showException | true | Output the exception if the exchange has failed | showRouteId | true | Camel 2.8: Output the id of the route | maxChars | | Is used to limit the number of chars logged per line. The default value is 10000 from Camel 2.9 onwards. |
|
Wiki Markup |
---|
{div:class=confluenceTableSmall}
|| Option || Default || Description ||
| breadCrumbLength | 0 | Fixed length of the bread crumb. 0 = no fixed length. Setting a value to e.g. 80 allows the tracer logs to be aligned for easier reading. |
| nodeLength | 0 | Fixed length of the node. 0 = no fixed length. Setting a value to e.g. 40 allows the tracer logs to be aligned for easier reading.
| showBreadCrumb | true | Outputs the unique unit of work for the exchange. To be used for correlation so you can identify the same exchange. |
| showNode | true | Previous and destination node, so you can see from -> to. |
| showExchangeId | false | To output the unique exchange id. Currently the breadcrumb is sufficient. |
| showShortExchangeId | false | To output the unique exchange id in short form, without the hostname. |
| showProperties | false | Output the exchange properties |
| showHeaders | true | Output the in message headers |
| showBodyType | true | Output the in body Java type |
| showBody | true | Output the in body |
| showOutHeaders | false | Output the out (if any) message headers |
| showOutBodyType | false | Output the out (if any) body Java type |
| showOutBody | false | Output the out (if any) body |
| showExchangePattern | true | Output the exchange pattern |
| showException | true | Output the exception if the exchange has failed |
| showRouteId | true | *Camel 2.8:* Output the id of the route |
| maxChars | | Is used to limit the number of chars logged per line. The default value is {{10000}} from *Camel 2.9* onwards. |
{div} |
Tip |
---|
title | Logging stream bodies |
---|
|
Camel Tracer will by default not log stream or files bodies from Camel 2.8 onwards. You can force Camel to log those by setting the property on the CamelContext properties Code Block |
---|
camelContext.getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS, true);
|
|
...