You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2016/09/13 14:18:40 UTC
svn commit: r997305 [2/2] - in /websites/production/camel/content:
backlogdebugger.html cache/main.pageCache debugger.html tracer-example.html
tracer.html
Modified: websites/production/camel/content/tracer.html
==============================================================================
--- websites/production/camel/content/tracer.html (original)
+++ websites/production/camel/content/tracer.html Tue Sep 13 14:18:40 2016
@@ -86,7 +86,7 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Tracer-TracerInterceptor">Tracer Interceptor</h2><p>Camel's tracer interceptor can be used for logging, by default at the <strong><code>INFO</code></strong> level, a route's execution. The tracer is an instance of <strong><code>org.apache.camel.spi.InterceptStrategy</code></strong>. It can be applied to either a <strong><code>DefaultCamelContext</code></strong> or a <strong><code>SpringCamelContext</code></strong> to ensure that there is a <strong><code>TracerInterceptor</code></strong> created for every node in the route. The tracer's logging can be enabled/disabled dynamically by calling its <strong><code>setEnabled</code></strong> method.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Logging dependencies</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Checkout which <a shap
e="rect" href="camel-jar-dependencies.html">dependencies</a> are required by Camel for logging purpose.</p></div></div><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From <strong>Camel 2.12</strong>: the <a shape="rect" href="camelcontext.html">CamelContext</a> must be explicitly configured for tracing:</p><ul><li>XML:  <strong><code><camelContext trace="true" ...></code></strong></li><li>Java: <strong><code>camelContext.setTracing(true)</code></strong>.</li></ul></div></div><h3 id="Tracer-Options">Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>
Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>destinationUri</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Optional destination URI to route <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/interceptor/TraceEventExchange.html">TraceEventExchange</a> containing <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/interceptor/TraceEventMessage.html">TraceEventMessage</a> with details about the trace. Can be used for custom processing to store traces in database using <a shape="rect" href="jpa.html">JPA</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>enabled</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Enable/disable the tracer.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>formatter</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the Trace Formatter to use.</p><p>Default: <strong><code>org.apache.camel.processor.interceptor.DefaultTraceFormatter</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>jpaTraceEventMessageClassName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> Fully qualified class name for a custom <strong><code>org.apache.camel.processor.interceptor.TraceEventMessage</code></strong> class which contains the traced information.</p><p>For example you can use your custom JPA @Entity class to store traced information in a database according to your schem
a layout.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>logLevel</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>INFO</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The logging level to use: <strong><code>FATAL</code>, <code>ERROR</code></strong>, <strong><code>WARN</code>, <code>INFO</code></strong>, <strong><code>DEBUG</code>, <code>TRACE</code></strong>, <strong><code>OFF</code></strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>logName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The log name to use.</p><p>Default: <strong><code>org.apache.camel.processor.interceptor.TraceInterceptor</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>logStackTrace</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><
td colspan="1" rowspan="1" class="confluenceTd"><p>Controls whether the stack trace of a traced exception should be logged. If <strong><code>false</code></strong> only the exception's class and message are logged.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceFilter</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>An Exchange <a shape="rect" href="predicate.html">Predicate</a> to filter the tracing.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceInterceptors</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enable/disable tracing of interceptors.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceExceptions</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p><
/td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enable/disable tracing of an exception thrown during the processing of an Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceHandler</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> To use a custom <strong><code>org.apache.camel.processor.interceptor.TraceEventHandler</code></strong> where you can control what happens when a trace event occurs.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceInterceptorFactory</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> To use a custom <strong><code>org.apache.camel.processor.interceptor.TraceInterceptorFactory</code></strong> where you can create the runtime trace instance wh
ich does the actual tracing. It should be a <strong><code>Processor</code></strong> instance.</p><p>Default: <strong><code>org.apache.camel.processor.interceptor.TraceInterceptor</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceOutExchanges</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enable/disable fine grained tracing, using a callback, for both <strong><code>IN</code></strong> (before) and <strong><code>OUT</code></strong> (after).</p><p>By default only one trace callback is executed.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>useJpa</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To use a <strong><code>JpaTraceEventMessage</code></strong> from <strong>camel-jpa</strong> component as the <strong>
<code>TraceEventMessage</code></strong>. This requires that <strong>camel-jpa.jar</strong> is on the classpath.</p></td></tr></tbody></table></div></div><h3 id="Tracer-Formatting">Formatting</h3><p>The tracer formats the execution of exchanges to log lines. They are logged at <strong><code>INFO</code></strong> level in the log category: <strong><code>org.apache.camel.processor.interceptor.TraceInterceptor</code></strong>. By default the tracer uses: <strong><code>org.apache.camel.processor.interceptor.DefaultTraceFormatter</code></strong> to format the log line.</p><p><strong><code>DefaultTraceFormatter</code></strong> has the following options:</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" row
span="1" class="confluenceTd"><p><code>breadCrumbLength</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Fixed length of the bread crumb. </p><p><code>0</code> = no fixed length.</p><p>Setting a value to e.g. <code>80</code> allows the tracer logs to be aligned for easier reading.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>maxChars</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Limits the number of chars logged per line.</p><p>From <strong>Camel 2.9</strong>: the default value is <strong><code>10000</code>.</strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>multiline</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.18:</strong> If <strong
><code>true</code></strong> each piece of information is logged on a new line.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>nodeLength</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Fixed length of the node. </p><p><code>0</code> = no fixed length.</p><p>Setting a value to e.g. <code>40</code> allows the tracer logs to be aligned for easier reading.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showBody</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the <strong><code>IN</code></strong> body.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showBodyType</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd">
<p>Output the <strong><code>IN</code></strong> body Java type.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showBreadCrumb</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Outputs the unique UnitOfWork for the exchange.</p><p>Can be used for correlation to identify a particular Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showException</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the exception if the processing of an Exchange has failed.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showExchangeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enable/disable the output of an Exchange'
s unique <strong><code>id</code></strong>.</p><p>Currently the breadcrumb is sufficient.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showExchangePattern</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the Message Exchange Pattern (MEP).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showHeaders</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the <strong><code>IN</code></strong> message headers.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showNode</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Previous and destination node.</p><p>Displayed as: <strong><code>from -> to</code></strong>.</p
></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showOutBody</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the <strong><code>OUT</code></strong> (if any) body.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showOutBodyType</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the <strong><code>OUT</code></strong> (if any) body Java type.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showOutHeaders</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the <strong><code>OUT</code></strong> (if any) message headers.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>sh
owProperties</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the Exchange's properties.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showRouteId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> output the <strong><code>id</code></strong> of the route.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showShortExchangeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To output the Exchange's unique <strong><code>id</code></strong> in short form, without the hostname.</p></td></tr></tbody></table></div></div><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Loggi
ng stream bodies</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From <strong>Camel 2.8</strong>: the Camel <a shape="rect" href="tracer.html">Tracer</a> will by default <em>not</em> log stream or files bodies. To force Camel to log these set the following property on the <a shape="rect" href="camelcontext.html">CamelContext</a> properties:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 id="Tracer-TracerInterceptor">Tracer Interceptor</h2><p>Camel's tracer interceptor can be used for logging, by default at the <strong><code>INFO</code></strong> level, a route's execution. The tracer is an instance of <strong><code>org.apache.camel.spi.InterceptStrategy</code></strong>. It can be applied to either a <strong><code>DefaultCamelContext</code></strong> or a <strong><code>SpringCamelContext</code></strong> to ensure that there is a <strong><code>TracerInterceptor</code></strong> created for every node in the route. The tracer's logging can be enabled/disabled dynamically by calling its <strong><code>setEnabled</code></strong> method.</p><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Logging dependencies</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Checkout which <a shap
e="rect" href="camel-jar-dependencies.html">dependencies</a> are required by Camel for logging purpose.</p></div></div><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From <strong>Camel 2.12</strong>: the <a shape="rect" href="camelcontext.html">CamelContext</a> must be explicitly configured for tracing:</p><ul><li>XML:  <strong><code><camelContext trace="true" ...></code></strong></li><li>Java: <strong><code>camelContext.setTracing(true)</code></strong>.</li></ul></div></div><h3 id="Tracer-Options">Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>
Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>destinationUri</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Optional destination URI to route <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/interceptor/TraceEventExchange.html">TraceEventExchange</a> containing <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/interceptor/TraceEventMessage.html">TraceEventMessage</a> with details about the trace. Can be used for custom processing to store traces in database using <a shape="rect" href="jpa.html">JPA</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>enabled</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Enable/disable the tracer.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>formatter</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the Trace Formatter to use.</p><p>Default: <strong><code>org.apache.camel.processor.interceptor.DefaultTraceFormatter</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>jpaTraceEventMessageClassName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> Fully qualified class name for a custom <strong><code>org.apache.camel.processor.interceptor.TraceEventMessage</code></strong> class which contains the traced information.</p><p>For example you can use your custom JPA @Entity class to store traced information in a database according to your schem
a layout.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>logLevel</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>INFO</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The logging level to use: <strong><code>FATAL</code>, <code>ERROR</code></strong>, <strong><code>WARN</code>, <code>INFO</code></strong>, <strong><code>DEBUG</code>, <code>TRACE</code></strong>, <strong><code>OFF</code></strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>logName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The log name to use.</p><p>Default: <strong><code>org.apache.camel.processor.interceptor.TraceInterceptor</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>logStackTrace</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><
td colspan="1" rowspan="1" class="confluenceTd"><p>Controls whether the stack trace of a traced exception should be logged. If <strong><code>false</code></strong> only the exception's class and message are logged.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceFilter</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>An Exchange <a shape="rect" href="predicate.html">Predicate</a> to filter the tracing.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceInterceptors</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enable/disable tracing of interceptors.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceExceptions</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p><
/td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enable/disable tracing of an exception thrown during the processing of an Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceHandler</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> To use a custom <strong><code>org.apache.camel.processor.interceptor.TraceEventHandler</code></strong> where you can control what happens when a trace event occurs.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceInterceptorFactory</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.3:</strong> To use a custom <strong><code>org.apache.camel.processor.interceptor.TraceInterceptorFactory</code></strong> where you can create the runtime trace instance wh
ich does the actual tracing. It should be a <strong><code>Processor</code></strong> instance.</p><p>Default: <strong><code>org.apache.camel.processor.interceptor.TraceInterceptor</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>traceOutExchanges</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enable/disable fine grained tracing, using a callback, for both <strong><code>IN</code></strong> (before) and <strong><code>OUT</code></strong> (after).</p><p>By default only one trace callback is executed.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>useJpa</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To use a <strong><code>JpaTraceEventMessage</code></strong> from <strong>camel-jpa</strong> component as the <strong>
<code>TraceEventMessage</code></strong>. This requires that <strong>camel-jpa.jar</strong> is on the classpath.</p></td></tr></tbody></table></div></div><h3 id="Tracer-Formatting">Formatting</h3><p>The tracer formats the execution of exchanges to log lines. They are logged at <strong><code>INFO</code></strong> level in the log category: <strong><code>org.apache.camel.processor.interceptor.TraceInterceptor</code></strong>. By default the tracer uses: <strong><code>org.apache.camel.processor.interceptor.DefaultTraceFormatter</code></strong> to format the log line.</p><p><strong><code>DefaultTraceFormatter</code></strong> has the following options:</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" row
span="1" class="confluenceTd"><p><code>breadCrumbLength</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Fixed length of the bread crumb. </p><p><code>0</code> = no fixed length.</p><p>Setting a value to e.g. <code>80</code> allows the tracer logs to be aligned for easier reading.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>maxChars</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Limits the number of chars logged per line.</p><p>From <strong>Camel 2.9</strong>: the default value is <strong><code>10000</code>.</strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>multiline</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.18:</s
trong> If <strong><code>true</code></strong> each piece of information is logged on a new line.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>nodeLength</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Fixed length of the node. </p><p><code>0</code> = no fixed length.</p><p>Setting a value to e.g. <code>40</code> allows the tracer logs to be aligned for easier reading.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showBody</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the <strong><code>IN</code></strong> body.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showBodyType</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Output the <strong><code>IN</code></strong> body Java type.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showBreadCrumb</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Outputs the unique UnitOfWork for the exchange.</p><p>Can be used for correlation to identify a particular Exchange.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showException</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the exception if the processing of an Exchange has failed.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showExchangeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enable/disable the o
utput of an Exchange's unique <strong><code>id</code></strong>.</p><p>Currently the breadcrumb is sufficient.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showExchangePattern</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the Message Exchange Pattern (MEP).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showHeaders</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the <strong><code>IN</code></strong> message headers.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showNode</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Previous and destination node.</p><p>Displayed as: <strong><code>from -> t
o</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showOutBody</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the <strong><code>OUT</code></strong> (if any) body.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showOutBodyType</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the <strong><code>OUT</code></strong> (if any) body Java type.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showOutHeaders</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the <strong><code>OUT</code></strong> (if any) message headers.</p></td></tr><tr><td colspan="1" rowspan="1" class="conf
luenceTd"><p><code>showProperties</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Output the Exchange's properties.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showRouteId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> output the <strong><code>id</code></strong> of the route.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>showShortExchangeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>To output the Exchange's unique <strong><code>id</code></strong> in short form, without the hostname.</p></td></tr></tbody></table></div></div><div class="confluence-information-macro confluence-information-macro-tip"><
p class="title">Logging stream bodies</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>From <strong>Camel 2.8</strong>: the Camel <a shape="rect" href="tracer.html">Tracer</a> will by default <em>not</em> log stream or files bodies. To force Camel to log these set the following property on the <a shape="rect" href="camelcontext.html">CamelContext</a> properties:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[camelContext.getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS, true);
]]></script>
</div></div></div></div><p>Example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
@@ -103,7 +103,7 @@
</div></div><p>or</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[java org.apache.camel.spring.Main -trace
]]></script>
-</div></div><p>and the tracer will be active.</p><h3 id="Tracer-EnablinginJava">Enabling in Java</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>and the tracer will be activated.</p><h3 id="Tracer-EnablinginJava">Enabling in Java</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[context.setTracing(true);
]]></script>
</div></div><p>You can configure tracing at a higher granularity as you can configure it on camel context and then override and set it per route as well. For instance you could just enable the tracer for a particular route.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
@@ -115,7 +115,7 @@ INFO TraceInterceptor - ID-davsclau
INFO TraceInterceptor - ID-davsclaus-local-54403-1246038742624-0-1 >>> MyProcessor --> mock:a , Pattern:InOnly, Headers:{from=Claus}, BodyType:String, Body:This is Copenhagen calling
INFO TraceInterceptor - ID-davsclaus-local-54403-1246038742624-0-1 >>> mock:a --> mock:b , Pattern:InOnly, Headers:{from=Claus}, BodyType:String, Body:This is Copenhagen calling
]]></script>
-</div></div><h3 id="Tracer-ConfiguringinJava">Configuring in Java</h3><p>The tracer options can be configured from the Java DSL like this:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="Tracer-ConfiguringinJava">Configuring in Java</h3><p>Tracer options can be configured in Java as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ public void configure() throws Exception {
// add tracer as an interceptor so it will log the exchange executions at runtime
// this can aid us to understand/see how the exchanges is routed etc.
@@ -155,7 +155,7 @@ INFO TraceInterceptor - ID-davsclau
</route>
</camelContext>
]]></script>
-</div></div>You can configure the formatting of tracer as a Spring bean. Just add a bean with the <strong><code>id="traceFormatter"</code></strong> and Camel will lookup this <strong><code>id</code></strong> and use the associated formatter.<p>Example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div> <p>You can configure the formatting of tracer as a Spring bean. Just add a bean with the <strong><code>id="traceFormatter"</code></strong> and Camel will lookup this <strong><code>id</code></strong> and use the associated formatter.</p><p>Example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
<bean id="traceFormatter" class="org.apache.camel.processor.interceptor.DefaultTraceFormatter">
<property name="showBody" value="true"/>
@@ -171,7 +171,7 @@ INFO TraceInterceptor - ID-davsclau
</route>
</camelContext>
]]></script>
-</div></div><h3 id="Tracer-EnableTracingofoutMessages">Enable Tracing of <code>out</code> Messages</h3><p>To trace the messages coming out of processing steps configure the tracer as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Java DSL</b></div><div class="codeContent panelContent pdl">
+</div></div><h3 id="Tracer-EnableTracingofOUTMessages">Enable Tracing of <code>OUT</code> Messages</h3><p>To trace the messages coming out of processing steps configure the tracer as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Java DSL</b></div><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
Tracer tracer = new Tracer();
tracer.setTraceOutExchanges(true);
@@ -187,7 +187,7 @@ tracer.setFormatter(formatter);
getContext().addInterceptStrategy(tracer);
]]></script>
-</div></div>or<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Spring DSL</b></div><div class="codeContent panelContent pdl">
+</div></div> <p>or</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Spring DSL</b></div><div class="codeContent panelContent pdl">
<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
<bean id="camelTracer" class="org.apache.camel.processor.interceptor.Tracer">
<property name="traceOutExchanges" value="true" />
@@ -198,7 +198,7 @@ getContext().addInterceptStrategy(tracer
<property name="showOutBodyType" value="true" />
</bean>
]]></script>
-</div></div>With these options the output will look like:<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div> <p>With these options the output will look like:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[INFO TraceInterceptor - ID-mojo/59899-1225474989226/2-0 -> transform(body) , Pattern:InOnly , Headers:{to=James} , BodyType:String , Body:Hello London
INFO TraceInterceptor - transform(body) -> ID-mojo/59899-1225474989226/2-0 , Pattern:InOnly , Headers:{to=James} , BodyType:String , Body:Hello London , OutBodyType:String , OutBody:Hello London
]]></script>
@@ -214,7 +214,7 @@ tracer.setFormatter(formatter);
// and we must remeber to add the tracer to Camel
getContext().addInterceptStrategy(tracer);
]]></script>
-</div></div>And here we have our custom logger that implements the <strong><code>TraceFormatter</code></strong> interface where we can construct the log message how we like:<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div> <p>And here we have our custom logger that implements the <strong><code>TraceFormatter</code></strong> interface where we can construct the log message how we like:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
// here we have out own formatter where we can create the output we want for trace logs
// as this is a test we just create a simple string with * around the body
@@ -238,7 +238,7 @@ tracer.setLogLevel(LoggingLevel.OFF);
// and we must remember to add the tracer to Camel
getContext().addInterceptStrategy(tracer);
]]></script>
-</div></div>Then we can configure a route for the traced messages:<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div> <p> </p><p>Then we can configure a route for the traced messages:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from("direct:traced")
.process(new MyTraceMessageProcessor())
.to("file://myapp/logs/trace);