Modified: websites/production/camel/content/tracer.html
==============================================================================
--- websites/production/camel/content/tracer.html (original)
+++ websites/production/camel/content/tracer.html Fri Aug 25 08:22:01 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' 
rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' 
rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' 
type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: Tracer
@@ -86,43 +75,22 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Tracer-TracerInterceptor">Tracer 
Interceptor</h2><div class="confluence-information-macro 
confluence-information-macro-warning"><span class="aui-icon aui-icon-small 
aui-iconfont-error confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Implementing custom tracing via 
TracingInterceptor has been deprecated. However turning tracing on via 
setTracing(true) is okay.</p></div></div><p>&#160;</p><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&#160;<strong><code>DefaultCamelContext</code></strong> or a 
<strong><code>SpringCamelContext</code></strong> to ensure that there is 
a&#160;<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 shape="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:&#160; 
<strong><code>&lt;camelContext trace="true" 
...&gt;</code></strong></li><li>Java: <strong><code>camelCo
 ntext.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/inter
 ceptor/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>&#160;</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 schema 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>,&#160;<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="conflue
 nceTd"><p>&#160;</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&#160;<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" cl
 ass="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 which 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&#160;<strong><code>IN</code></strong> (before) 
and&#160;<strong><code>OUT</code></strong> (after).</p><p>By defaul
 t 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&#160;<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" 
rowspan="1" class="confluenceTd"><p><code>breadCrumbLength</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td col
 span="1" rowspan="1" class="confluenceTd"><p>Fixed length of the bread 
crumb.&#160;</p><p><code>0</code> = no fixed length.</p><p>Setting a value to 
e.g.&#160;<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>&#160;</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:</strong> 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="confl
 uenceTd"><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.&#160;</p><p><code>0</code> = 
no fixed length.</p><p>Setting a value to e.g.&#160;<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&#160;<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&#160;<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&#160;<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 -&gt; 
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" clas
 s="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Output the&#160;<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&#160;<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&#160;<strong><code>OUT</code></strong> (if any) message 
headers.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><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&#160;<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">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[ID-claus-acer/4412-1222625653890/2-0 -&gt; 
to(mock:a)                , Pattern:InOnly , Headers:{to=James} , 
BodyType:String , Body:Hello London
-]]></script>
-</div></div><p>where:</p><ul><li><strong><code>ID-claus-acer/3690-1214458315718/2-0</code></strong>
 is the breadcrumb with the unique correlation id.</li><li><strong> 
<code>node3</code></strong> is the id of the node in the route path. Always 
displayed.</li><li><strong> <code>To[mock:a]</code></strong> is the destination 
node.</li><li><strong> <code>InOnly</code></strong> is the exchange pattern. Is 
always shown.</li><li>Then the rest is properties, headers and the 
body.</li></ul><h4 id="Tracer-Showingfromandto">Showing&#160;<code>from</code> 
and&#160;<code>to</code></h4><p>The trace log will output both the from and to 
so you can see where the Exchange came from, such as:</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[&gt;&gt;&gt; direct:start --&gt; 
process(MyProcessor)
+<div class="wiki-content maincontent"><h2 id="Tracer-TracerInterceptor">Tracer 
Interceptor</h2><rich-text-body><p>Implementing custom tracing via 
TracingInterceptor has been deprecated. However turning tracing on via 
setTracing(true) is okay.</p></rich-text-body><p>&#160;</p><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&#160;<strong><code>DefaultCamelContext</code></strong> or a 
<strong><code>SpringCamelContext</code></strong> to ensure that there is 
a&#160;<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><parameter 
ac:name="title">Logging dependencies</parameter><rich-text-body><p>Checkout 
which <a shape="rect
 " href="camel-jar-dependencies.html">dependencies</a> are required by Camel 
for logging purpose.</p></rich-text-body><rich-text-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:&#160; 
<strong><code>&lt;camelContext trace="true" 
...&gt;</code></strong></li><li>Java: 
<strong><code>camelContext.setTracing(true)</code></strong>.</li></ul></rich-text-body><h3
 id="Tracer-Options">Options</h3><parameter 
ac:name="class">confluenceTableSmall</parameter><rich-text-body><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>&#160;</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 schema 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>,&#160;<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>&#160;</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&#160;<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 colspa
 n="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 which does the actual tracing. 
It should be a <strong><code>Processor</code></strong> instance.</p><p>Default: 
<strong><code>org.apache.camel.processor.interceptor.Trace
 Interceptor</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&#160;<strong><code>IN</code></strong> (before) 
and&#160;<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></rich-text-body><h3
  id="Tracer-Formatting">Formatting</h3><p>The tracer formats the execution of 
exchanges to log lines. They are logged 
at&#160;<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><parameter 
ac:name="class">confluenceTableSmall</parameter><rich-text-body><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>breadCrumbLength</code></p></td><td 
colspan="1" rowspan="1" class="confluenc
 eTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Fixed length of the bread 
crumb.&#160;</p><p><code>0</code> = no fixed length.</p><p>Setting a value to 
e.g.&#160;<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>&#160;</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:</strong> If 
<strong><code>true</code></strong> each piece of information is logged on a new 
line.</p></td></tr><tr><t
 d 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.&#160;</p><p><code>0</code> = no fixed length.</p><p>Setting a value to 
e.g.&#160;<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&#160;<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&#160;<strong><code>IN</code></strong> body Java type.</p></td></tr><tr><td 
colsp
 an="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&#160;<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 -&gt; 
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&#160;<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&#160;<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&#160;<strong><code>OUT</code></strong> (if any) message 
 >headers.</p></td></tr><tr><td colspan="1" rowspan="1" 
 >class="confluenceTd"><p><code>showProperties</code></p></td><td colspan="1" 
 >rowspan="1" class="confluenceTd"><p><code>false</c
 ode></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&#160;<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></rich-text-body><parameter 
ac:name="title">Logging stream bodies</parameter><rich-text-body><p>From 
<strong>Camel 2.8</strong>: the Camel <a shape="rect" 
href="tracer.html">Tracer</a> will by defa
 ult <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><parameter 
ac:name="language">java</parameter><plain-text-body>camelContext.getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS,
 true);
+</plain-text-body></rich-text-body><p>Example:</p><plain-text-body>ID-claus-acer/4412-1222625653890/2-0
 -&gt; to(mock:a)                , Pattern:InOnly , Headers:{to=James} , 
BodyType:String , Body:Hello London
+</plain-text-body><p>where:</p><ul><li><strong><code>ID-claus-acer/3690-1214458315718/2-0</code></strong>
 is the breadcrumb with the unique correlation id.</li><li><strong> 
<code>node3</code></strong> is the id of the node in the route path. Always 
displayed.</li><li><strong> <code>To[mock:a]</code></strong> is the destination 
node.</li><li><strong> <code>InOnly</code></strong> is the exchange pattern. Is 
always shown.</li><li>Then the rest is properties, headers and the 
body.</li></ul><h4 id="Tracer-Showingfromandto">Showing&#160;<code>from</code> 
and&#160;<code>to</code></h4><p>The trace log will output both the from and to 
so you can see where the Exchange came from, such 
as:</p><plain-text-body>&gt;&gt;&gt; direct:start --&gt; process(MyProcessor)
 &gt;&gt;&gt; process(MyProcessor) --&gt; to(mock:a)
 &gt;&gt;&gt; to(mock:a) --&gt; to(mock:b)
-]]></script>
-</div></div><h3 id="Tracer-Enabling">Enabling</h3><p>To enable tracer from the 
main run:</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 -t
-]]></script>
-</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 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">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[INFO  TraceInterceptor     - 
ID-davsclaus-local-54403-1246038742624-0-0 &gt;&gt;&gt; from(direct:start) 
--&gt; MyProcessor     , Pattern:InOnly, Headers:{to=James}, BodyType:String, 
Body:Hello London
+</plain-text-body><h3 id="Tracer-Enabling">Enabling</h3><p>To enable tracer 
from the main run:</p><plain-text-body>java org.apache.camel.spring.Main -t
+</plain-text-body><p>or</p><plain-text-body>java org.apache.camel.spring.Main 
-trace
+</plain-text-body><p>and the tracer will be activated.</p><h3 
id="Tracer-EnablinginJava">Enabling in Java</h3><parameter 
ac:name="language">java</parameter><plain-text-body>context.setTracing(true);
+</plain-text-body><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><plain-text-body>INFO  TraceInterceptor     - 
ID-davsclaus-local-54403-1246038742624-0-0 &gt;&gt;&gt; from(direct:start) 
--&gt; MyProcessor     , Pattern:InOnly, Headers:{to=James}, BodyType:String, 
Body:Hello London
 INFO  TraceInterceptor     - ID-davsclaus-local-54403-1246038742624-0-0 
&gt;&gt;&gt; MyProcessor --&gt; mock:a                 , Pattern:InOnly, 
Headers:{to=James}, BodyType:String, Body:Hello London
 INFO  TraceInterceptor     - ID-davsclaus-local-54403-1246038742624-0-0 
&gt;&gt;&gt; mock:a --&gt; mock:b                      , Pattern:InOnly, 
Headers:{to=James}, BodyType:String, Body:Hello London
 ...
 INFO  TraceInterceptor     - ID-davsclaus-local-54403-1246038742624-0-1 
&gt;&gt;&gt; from(direct:start) --&gt; MyProcessor     , Pattern:InOnly, 
Headers:{from=Claus}, BodyType:String, Body:This is Copenhagen calling
 INFO  TraceInterceptor     - ID-davsclaus-local-54403-1246038742624-0-1 
&gt;&gt;&gt; MyProcessor --&gt; mock:a                 , Pattern:InOnly, 
Headers:{from=Claus}, BodyType:String, Body:This is Copenhagen calling
 INFO  TraceInterceptor     - ID-davsclaus-local-54403-1246038742624-0-1 
&gt;&gt;&gt; mock:a --&gt; 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>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 {
+</plain-text-body><h3 id="Tracer-ConfiguringinJava">Configuring in 
Java</h3><p>Tracer options can be configured in Java as follows:</p><parameter 
ac:name="language">java</parameter><plain-text-body>    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.
         Tracer tracer = new Tracer();
@@ -130,190 +98,20 @@ INFO  TraceInterceptor     - ID-davsclau
         formatter.getDefaultTraceFormatter().setShowNode(false);
         ...
         getContext().addInterceptStrategy(tracer);
-]]></script>
-</div></div><h4 id="Tracer-UsingPredicatestoFilterExchanges">Using Predicates 
to Filter Exchanges</h4><p>In the code below we want the tracer only to trace 
if the body contains the text <strong><code>London</code></strong>. As this is 
just an example can of course set any <a shape="rect" 
href="predicate.html">Predicate</a> that matches your criteria:</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[    Tracer tracer = new Tracer();
+</plain-text-body><h4 id="Tracer-UsingPredicatestoFilterExchanges">Using 
Predicates to Filter Exchanges</h4><p>In the code below we want the tracer only 
to trace if the body contains the text <strong><code>London</code></strong>. As 
this is just an example can of course set any <a shape="rect" 
href="predicate.html">Predicate</a> that matches your criteria:</p><parameter 
ac:name="">java</parameter><plain-text-body>    Tracer tracer = new Tracer();
     // set the level to FATAL so we can easily spot it
     tracer.setLogLevel(LoggingLevel.FATAL);
     // and only trace if the body contains London as text
-    tracer.setTraceFilter(body().contains(constant(&quot;London&quot;)));
-]]></script>
-</div></div><h3 id="Tracer-EnablinginSpringXML">Enabling in Spring 
XML</h3><p>There is now a&#160;<strong><code>trace</code></strong> attribute 
you can specify on 
the&#160;<strong><code>&lt;camelContext/&gt;</code></strong>.</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[  &lt;camelContext trace=&quot;true&quot; 
xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;&gt;
+    tracer.setTraceFilter(body().contains(constant("London")));
+</plain-text-body><h3 id="Tracer-EnablinginSpringXML">Enabling in Spring 
XML</h3><p>There is now a&#160;<strong><code>trace</code></strong> attribute 
you can specify on 
the&#160;<strong><code>&lt;camelContext/&gt;</code></strong>.</p><p>Example:</p><parameter
 ac:name="language">xml</parameter><plain-text-body>  &lt;camelContext 
trace="true" xmlns="http://activemq.apache.org/camel/schema/spring"&gt;
     ...
   &lt;/camelContext&gt;
-]]></script>
-</div></div><p>You can see this in action with the <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTraceTest.java";>SpringTraceTest</a>
 and its <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringTraceTest-context.xml";>spring.xml
 file</a></p><p>Another option is to just include a spring XML which defines 
the Tracer bean such as the <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/spring/trace.xml";>one
 that is automatically included if you run the Main with -t above</a>.</p><h3 
id="Tracer-ConfiguringinSpringXML">Configuring in Spring XML</h3><p>You can 
configure the tracer as a Spring bean. Just add a bean with the bean class 
<strong><co
 de>org.apache.camel.processor.interceptor.Tracer</code></strong> and Camel 
will use it as the tracer.</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[
-&lt;!-- we can configure the tracer by defining the tracer bean and set the 
properties as we like --&gt;
-&lt;!-- the id name can be anything its the class that must be 
org.apache.camel.processor.interceptor.Tracer --&gt;
-&lt;bean id=&quot;camelTracer&quot; 
class=&quot;org.apache.camel.processor.interceptor.Tracer&quot;&gt;
-    &lt;property name=&quot;traceExceptions&quot; value=&quot;false&quot;/&gt;
-    &lt;property name=&quot;traceInterceptors&quot; value=&quot;true&quot;/&gt;
-    &lt;property name=&quot;logLevel&quot; value=&quot;ERROR&quot;/&gt;
-    &lt;property name=&quot;logName&quot; 
value=&quot;com.mycompany.messages&quot;/&gt;
-&lt;/bean&gt;
-
-&lt;camelContext trace=&quot;true&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:start&quot;/&gt;
-        &lt;to uri=&quot;mock:result&quot;/&gt;
-    &lt;/route&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div>&#160;<p>You can configure the formatting of tracer as a Spring 
bean. Just add a bean with 
the&#160;<strong><code>id="traceFormatter"</code></strong> and Camel will 
lookup this&#160;<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[
-&lt;bean id=&quot;traceFormatter&quot; 
class=&quot;org.apache.camel.processor.interceptor.DefaultTraceFormatter&quot;&gt;
-    &lt;property name=&quot;showBody&quot; value=&quot;true&quot;/&gt;
-    &lt;property name=&quot;showBodyType&quot; value=&quot;false&quot;/&gt;
-    &lt;property name=&quot;showBreadCrumb&quot; value=&quot;false&quot;/&gt;
-    &lt;property name=&quot;maxChars&quot; value=&quot;100&quot;/&gt;
-&lt;/bean&gt;
-
-&lt;camelContext trace=&quot;true&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-    &lt;route&gt;
-        &lt;from uri=&quot;direct:start&quot;/&gt;
-        &lt;to uri=&quot;mock:result&quot;/&gt;
-    &lt;/route&gt;
-&lt;/camelContext&gt;
-]]></script>
-</div></div><h3 id="Tracer-EnableTracingofOUTMessages">Enable Tracing 
of&#160;<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);
-
-// we configure the default trace formatter where we can
-// specify which fields we want in the output
-DefaultTraceFormatter formatter = new DefaultTraceFormatter();
-formatter.setShowOutBody(true);
-formatter.setShowOutBodyType(true);
-
-// set to use our formatter
-tracer.setFormatter(formatter);
-
-getContext().addInterceptStrategy(tracer);
-]]></script>
-</div></div>&#160;<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[
-&lt;bean id=&quot;camelTracer&quot; 
class=&quot;org.apache.camel.processor.interceptor.Tracer&quot;&gt;
-  &lt;property name=&quot;traceOutExchanges&quot; value=&quot;true&quot; /&gt;
-&lt;/bean&gt;
-
-&lt;bean id=&quot;traceFormatter&quot; 
class=&quot;org.apache.camel.processor.interceptor.DefaultTraceFormatter&quot;&gt;
-  &lt;property name=&quot;showOutBody&quot; value=&quot;true&quot; /&gt;
-  &lt;property name=&quot;showOutBodyType&quot; value=&quot;true&quot; /&gt;
-&lt;/bean&gt;
-]]></script>
-</div></div>&#160;<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 -&gt; transform(body) , Pattern:InOnly , 
Headers:{to=James} , BodyType:String , Body:Hello London
+</plain-text-body><p>You can see this in action with the <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTraceTest.java";>SpringTraceTest</a>
 and its <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/SpringTraceTest-context.xml";>spring.xml
 file</a></p><p>Another option is to just include a spring XML which defines 
the Tracer bean such as the <a shape="rect" class="external-link" 
href="http://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/main/resources/META-INF/services/org/apache/camel/spring/trace.xml";>one
 that is automatically included if you run the Main with -t above</a>.</p><h3 
id="Tracer-ConfiguringinSpringXML">Configuring in Spring XML</h3><p>You can 
configure the tracer as a Spring bean. Just add a bean with the bean class <stro
 ng><code>org.apache.camel.processor.interceptor.Tracer</code></strong> and 
Camel will use it as the 
tracer.<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/interceptor/tracerConfigurationTest.xml}</plain-text-body>&#160;</p><p>You
 can configure the formatting of tracer as a Spring bean. Just add a bean with 
the&#160;<strong><code>id="traceFormatter"</code></strong> and Camel will 
lookup this&#160;<strong><code>id</code></strong> and use the associated 
formatter.</p><p>Example:<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/interceptor/traceFormatterTest.xml}</plain-text-body></p><h3
 id="Tracer-EnableTracingofOUTMessages">Enable Tracing of&#160;<code>OUT</code> 
Messages</h3><p>To trace the messages coming out of processing steps configure 
the tracer as 
follows:<plain-text-body>{snippet:id=tracingOutExchanges|title=Java 
DSL|lang=java|ur
 
l=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TraceInterceptorWithOutBodyTraceTest.java}</plain-text-body>&#160;</p><p>or<plain-text-body>{snippet:id=tracingOutExchanges|title=Spring
 
DSL|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/traceInterceptorWithOutBodyTrace.xml}</plain-text-body>&#160;</p><p>With
 these options the output will look like:</p><plain-text-body>INFO  
TraceInterceptor - ID-mojo/59899-1225474989226/2-0 -&gt; transform(body) , 
Pattern:InOnly , Headers:{to=James} , BodyType:String , Body:Hello London
 INFO  TraceInterceptor - transform(body) -&gt; ID-mojo/59899-1225474989226/2-0 
, Pattern:InOnly , Headers:{to=James} , BodyType:String , Body:Hello London , 
OutBodyType:String , OutBody:Hello London
-]]></script>
-</div></div><h3 id="Tracer-UsingaCustomFormatter">Using a Custom 
Formatter</h3><p>To create a custom formatter create a class that implements 
the interface 
<strong><code>org.apache.camel.processor.interceptor.TraceFormatter</code></strong>.</p><p>Example:</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[
-// we create a tracer where we want to use our own formatter instead of the 
default one
-Tracer tracer = new Tracer();
-
-// use our own formatter instead of the default one
-MyTraceFormatter formatter = new MyTraceFormatter();
-tracer.setFormatter(formatter);
-
-// and we must remeber to add the tracer to Camel
-getContext().addInterceptStrategy(tracer);
-]]></script>
-</div></div>&#160;<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
-class MyTraceFormatter implements TraceFormatter {
-
-    public Object format(TraceInterceptor interceptor, 
ProcessorDefinition&lt;?&gt; node, Exchange exchange) {
-        return &quot;***&quot; + exchange.getIn().getBody(String.class) + 
&quot;***&quot;;
-    }
-}
-]]></script>
-</div></div><h3 
id="Tracer-UsingaDestinationforCustomProcessingandRouting">Using a Destination 
for Custom Processing and Routing</h3><p>Tracer supports custom processing of 
trace events. This can be used to route a trace event to a <a shape="rect" 
href="jpa.html">JPA</a> endpoint for persistence in a database.</p><p>This 
works by Camel creates a new <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>
 containing:</p><ul class="alternate"><li>snapshot of the original traced 
Exchange as a immutable <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>
 containing String values of the fields, when the interception occurred. This 
ensures the fields contains the exact data at the given time of 
interception.</li><li>the original 
 Exchange can in some implementations be accessed using 
<strong><code>getTracedExchange()</code></strong> (though with JPA based tracer 
you cannot get the original Exchange).</li></ul><div 
class="confluence-information-macro confluence-information-macro-warning"><span 
class="aui-icon aui-icon-small aui-iconfont-error 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Beware to access the original 
Exchange to avoid causing any side effects or alter its state. Prefer to access 
the information from <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></p></div></div><p>Camel
 routes the&#160;<strong><code>TraceEventMessage</code></strong> synchronously 
from the point of interception. When its completed Camel will continue routing 
the original Exchange.</p><p>The sample below demonstrates this feature, where 
we route t
 raced Exchanges to the <strong><code>direct:traced</code></strong> 
route:</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[
-// we create a tracer where we want to send TraveEvents to an endpoint
-// &quot;direct:traced&quot; where we can do some custom processing such as 
storing
-// it in a file or a database
-Tracer tracer = new Tracer();
-tracer.setDestinationUri(&quot;direct:traced&quot;);
-// we disable regular trace logging in the log file. You can omit this and
-// have both.
-tracer.setLogLevel(LoggingLevel.OFF);
-// and we must remember to add the tracer to Camel
-getContext().addInterceptStrategy(tracer);
-]]></script>
-</div></div>&#160;<p>&#160;</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(&quot;direct:traced&quot;)
+</plain-text-body><h3 id="Tracer-UsingaCustomFormatter">Using a Custom 
Formatter</h3><p>To create a custom formatter create a class that implements 
the interface 
<strong><code>org.apache.camel.processor.interceptor.TraceFormatter</code></strong>.</p><p>Example:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceFormatterTest.java}</plain-text-body>&#160;</p><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:<plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceFormatterTest.java}</plain-text-body></p><h3
 id="Tracer-UsingaDestinationforCustomProcessingandRouting">Using a Destination 
for Custom Processing and Routing</h3><p>Tracer supports custom processing of 
trace events. This can be used to route a trace event to a <a shape="
 rect" href="jpa.html">JPA</a> endpoint for persistence in a 
database.</p><p>This works by Camel creates a new <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>
 containing:</p><ul class="alternate"><li>snapshot of the original traced 
Exchange as a immutable <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>
 containing String values of the fields, when the interception occurred. This 
ensures the fields contains the exact data at the given time of 
interception.</li><li>the original Exchange can in some implementations be 
accessed using <strong><code>getTracedExchange()</code></strong> (though with 
JPA based tracer you cannot get the original 
Exchange).</li></ul><rich-text-body><p>Beware to access the original Exchange t
 o avoid causing any side effects or alter its state. Prefer to access the 
information from <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></p></rich-text-body><p>Camel
 routes the&#160;<strong><code>TraceEventMessage</code></strong> synchronously 
from the point of interception. When its completed Camel will continue routing 
the original Exchange.</p><p>The sample below demonstrates this feature, where 
we route traced Exchanges to the <strong><code>direct:traced</code></strong> 
route:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorDestinationTest.java}</plain-text-body>&#160;</p><p>&#160;</p><p>Then
 we can configure a route for the traced 
messages:</p><plain-text-body>from("direct:traced")
   .process(new MyTraceMessageProcessor())
-  .to(&quot;file://myapp/logs/trace);
-]]></script>
-</div></div><p>And our processor where we can process the 
<strong><code>TraceEventMessage</code></strong>. Here we want to create a CSV 
format of the trace event to be stored as a file. We do this by constructing 
the CSV String and the replace the&#160;<strong><code>IN</code></strong> body 
with our String instead of the 
<strong><code>TraceEventMessage</code></strong>.</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[
-class MyTraceMessageProcessor implements Processor {
-
-    public void process(Exchange exchange) throws Exception {
-        // here we can transform the message how we like want it
-        TraceEventMessage msg = 
exchange.getIn().getBody(DefaultTraceEventMessage.class);
-
-        // we want to store it as a CSV with from;to;exchangeId;body
-        String s = msg.getFromEndpointUri() + &quot;;&quot; + msg.getToNode() 
+ &quot;;&quot; + msg.getExchangeId() + &quot;;&quot; + msg.getBody();
-
-        // so we replace the IN body with our CSV string
-        exchange.getIn().setBody(s);
-    }
-}
-]]></script>
-</div></div><h3 id="Tracer-UsingasaDatastoreforTraceMessages">Using <a 
shape="rect" href="jpa.html">JPA</a> as a Datastore for Trace 
Messages</h3><p>See <a shape="rect" href="tracer-example.html">Tracer 
Example</a> for complete documentation and how to use this feature.</p><h3 
id="Tracer-TracedRoutePathDuringRuntime">Traced Route Path During 
Runtime</h3><p><a shape="rect" href="tracer.html">Tracer</a> also traces the 
actual route path taken during runtime. Camel will store the route path taken 
on the UnitOfWork when <a shape="rect" href="tracer.html">Tracer</a> is 
enabled. The example below demonstrates how we can use that for error handling 
where we can determine at which node in the route graph the error 
triggered.</p><p>First we define our route:</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[
-protected RouteBuilder createRouteBuilder() throws Exception {
-    return new RouteBuilder() {
-        public void configure() throws Exception {
-            
errorHandler(deadLetterChannel(&quot;mock:error&quot;).redeliveryDelay(0).maximumRedeliveries(3));
-
-            // must enable tracer to trace the route path taken during runtime
-            context.setTracing(true);
-
-            // let our my error processor handle all exceptions
-            onException(Exception.class).handled(true).process(new 
MyErrorProcessor());
-
-            // our route where an exception can be thrown from either foo or 
bar bean
-            // so we have enable tracing so we can check it at runtime to get 
the actual
-            // node path taken
-            
from(&quot;direct:start&quot;).to(&quot;bean:foo&quot;).to(&quot;bean:bar&quot;);
-        }
-    };
-}
-]]></script>
-</div></div>And then our custom error processor where we can handle the 
exception and figure out at which node the exception occurred.<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[
-private static class MyErrorProcessor implements Processor {
-    public void process(Exchange exchange) throws Exception {
-        TracedRouteNodes traced = 
exchange.getUnitOfWork().getTracedRouteNodes();
-
-        // get the list of intercepted nodes
-        List&lt;RouteNode&gt; list = traced.getNodes();
-        // get the 3rd last as its the bean
-        Processor last = list.get(list.size() - 3).getProcessor();
-
-        // wrapped by JMX
-        if (last instanceof InstrumentationProcessor) {
-            InstrumentationProcessor ip = (InstrumentationProcessor) last;
-            last = ip.getProcessor();
-        }
-
-        // set error message
-        exchange.getOut().setFault(true);
-        exchange.getOut().setBody(&quot;Failed at: &quot; + last.toString());
-    }
-
-    public String toString() {
-        return &quot;MyErrorProcessor&quot;;
-    }
-}
-]]></script>
-</div></div><h3 id="Tracer-SeeAlso">See Also</h3><ul class="alternate"><li><a 
shape="rect" href="tracer-example.html">Tracer Example</a></li><li><a 
shape="rect" href="debugger.html">Debugger</a></li><li><a shape="rect" 
href="delay-interceptor.html">Delay Interceptor</a></li><li><a shape="rect" 
href="log.html">Log</a></li></ul></div>
+  .to("file://myapp/logs/trace);
+</plain-text-body><p>And our processor where we can process the 
<strong><code>TraceEventMessage</code></strong>. Here we want to create a CSV 
format of the trace event to be stored as a file. We do this by constructing 
the CSV String and the replace the&#160;<strong><code>IN</code></strong> body 
with our String instead of the 
<strong><code>TraceEventMessage</code></strong>.<plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorDestinationTest.java}</plain-text-body></p><h3
 id="Tracer-UsingasaDatastoreforTraceMessages">Using <a shape="rect" 
href="jpa.html">JPA</a> as a Datastore for Trace Messages</h3><p>See <a 
shape="rect" href="tracer-example.html">Tracer Example</a> for complete 
documentation and how to use this feature.</p><h3 
id="Tracer-TracedRoutePathDuringRuntime">Traced Route Path During 
Runtime</h3><p><a shape="rect" href="tracer.html">Tracer</a> also traces the 
actual route path taken during 
 runtime. Camel will store the route path taken on the UnitOfWork when <a 
shape="rect" href="tracer.html">Tracer</a> is enabled. The example below 
demonstrates how we can use that for error handling where we can determine at 
which node in the route graph the error triggered.</p><p>First we define our 
route:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java}</plain-text-body>And
 then our custom error processor where we can handle the exception and figure 
out at which node the exception 
occurred.<plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TraceableUnitOfWorkTest.java}</plain-text-body></p><h3
 id="Tracer-SeeAlso">See Also</h3><ul class="alternate"><li><a shape="rect" 
href="tracer-example.html">Tracer Example</a></li><li><a shape="rect" 
href="debugger.html">Debugger</a></li><li><a shape="rect" 
href="delay-interceptor.html">Delay Interce
 ptor</a></li><li><a shape="rect" href="log.html">Log</a></li></ul></div>
         </td>
         <td valign="top">
           <div class="navigation">


Reply via email to