Author: buildbot Date: Tue Sep 20 19:19:29 2016 New Revision: 997842 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/mdc-logging.html Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/mdc-logging.html ============================================================================== --- websites/production/camel/content/mdc-logging.html (original) +++ websites/production/camel/content/mdc-logging.html Tue Sep 20 19:19:29 2016 @@ -41,6 +41,7 @@ <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; @@ -85,97 +86,39 @@ <tbody> <tr> <td valign="top" width="100%"> -<div class="wiki-content maincontent"><h2 id="MDClogging-MDClogging">MDC logging</h2> -<p><strong>Available as of Camel 2.7</strong></p> - -<p>In Camel 2.7 we migrated to use <a shape="rect" class="external-link" href="http://www.slf4j.org/" rel="nofollow">slf4j</a> as the logging framework in Camel. This allows us to support <a shape="rect" class="external-link" href="http://www.slf4j.org/api/org/slf4j/MDC.html" rel="nofollow">MDC logging</a>.<br clear="none"> -See more details about MDC logging in the <a shape="rect" class="external-link" href="http://logback.qos.ch/manual/mdc.html" rel="nofollow">logback manual</a>.</p> - -<p>The log kit in use must support MDC, such as:</p> -<ul class="alternate"><li><a shape="rect" class="external-link" href="http://logging.apache.org/log4j/1.2/">log4j</a></li><li><a shape="rect" class="external-link" href="http://logback.qos.ch/" rel="nofollow">logback</a></li><li><a shape="rect" class="external-link" href="http://wiki.ops4j.org/display/paxlogging/Pax+Logging" rel="nofollow">pax logging</a></li></ul> - - -<p>See the log kit documentation how to configure and use MDC.</p> - -<h3 id="MDClogging-EnablinginCamel">Enabling in Camel</h3> - -<p>To enable MDC logging in Camel you can do it 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[ -CamelContext context = ... +<div class="wiki-content maincontent"><h2 id="MDClogging-MDClogging">MDC logging</h2><p><strong>Available as of Camel 2.7</strong></p><p>From <strong>Camel 2.7</strong>: Camel uses the <a shape="rect" class="external-link" href="http://www.slf4j.org/" rel="nofollow">SLF4J</a> logging framework. This allows Camel to support <a shape="rect" class="external-link" href="http://www.slf4j.org/api/org/slf4j/MDC.html" rel="nofollow">MDC logging</a>. For more information about about MDC logging see the <a shape="rect" class="external-link" href="http://logback.qos.ch/manual/mdc.html" rel="nofollow">logback manual</a>.</p><p>The logging framework in use must support MDC. The following frameworks support MDC:</p><ul class="alternate"><li><a shape="rect" class="external-link" href="http://logging.apache.org/log4j/1.2/">log4j</a></li><li><a shape="rect" class="external-link" href="http://logback.qos.ch/" rel="nofollow">logback</a></li><li><a shape="rect" class="external-link" href="http://wiki.o ps4j.org/display/paxlogging/Pax+Logging" rel="nofollow">pax logging</a></li></ul><p>See the logging framework's documentation for how to configure it to use MDC.</p><h3 id="MDClogging-EnablingMDCLogginginCamel">Enabling MDC Logging in Camel</h3><p>To enable MDC logging using Java:</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 context = ... context.setUseMDCLogging(true); ... ]]></script> -</div></div> - -<p>In XML you enable it using the <code>useMDCLogging</code> attribute as follows:</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[ -<camelContext xmlns="http://camel.apache.org/schema/spring" useMDCLogging="true"> +</div></div><p>To enable MDC logging using Spring XML set CamelContext's <strong><code>useMDCLogging</code></strong> attribute:</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[<camelContext xmlns="http://camel.apache.org/schema/spring" useMDCLogging="true"> ... </camelContext> ]]></script> -</div></div> - -<h3 id="MDClogging-MDCinformation">MDC information</h3> - -<p>Camel provides the following context information available for MDC:</p> - -<h4 id="MDClogging-Camel2.9.xorolder">Camel 2.9.x or older</h4> -<div class="confluenceTableSmall"><div class="table-wrap"> - <table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Key </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>exchangeId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The exchange id </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>messageId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.9.1:</strong> The message id </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>correlationId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The correlation id of the exchange if it's correlated. For example a sub message from the <a shape="rect" href="splitter.html">Splitter</a> EIP </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>transactionKey</code> </p></td><td colspan="1" rowspan="1" class="co nfluenceTd"><p> The id of the transaction for transacted exchanges. Note the id is not unique, but its the id of the transaction template that marks the transaction boundary for the given transaction. Hence we decided to name the key <code>transactionKey</code> and not <code>transactionID</code> to point out this fact. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>routeId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The id of the route, in which the exchange is currently being routed </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>breadcrumbId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.8:</strong> An unique id used for tracking messages across transports. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>camelContextId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.8.3/2.9:</strong> the camel co ntext id used for tracking the message from different camel context. </p></td></tr></tbody></table> -</div></div> - -<h4 id="MDClogging-Camel2.10onwards">Camel 2.10 onwards</h4> -<div class="confluenceTableSmall"><div class="table-wrap"> - <table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Key </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>camel.exchangeId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The exchange id </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>camel.messageId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The message id </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>camel.correlationId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The correlation id of the exchange if it's correlated. For example a sub message from the <a shape="rect" href="splitter.html">Splitter</a> EIP </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>camel.transactionKey</code> </p></td><td colspan="1" rowspan="1" class="confluen ceTd"><p> The id of the transaction for transacted exchanges. Note the id is not unique, but its the id of the transaction template that marks the transaction boundary for the given transaction. Hence we decided to name the key <code>transactionKey</code> and not <code>transactionID</code> to point out this fact. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>camel.routeId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The id of the route, in which the exchange is currently being routed </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>camel.breadcrumbId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> An unique id used for tracking messages across transports. </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>camel.contextId</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The camel context id used for tracking the message from different c amel context. </p></td></tr></tbody></table> -</div></div> - -<p>The keys are subject to change as we want to align and leverage MDC across other Apache products such as <a shape="rect" class="external-link" href="http://activemq.apache.org">ActiveMQ</a>, <a shape="rect" class="external-link" href="http://servicemix.apache.org/">ServiceMix</a> and <a shape="rect" class="external-link" href="http://karaf.apache.org/">Karaf</a>. </p> - -<h3 id="MDClogging-Exampleusinglog4j">Example using log4j</h3> - -<p>If you use log4j you can configure MDC in the log4j.properties file as shown:</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[ -log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.exchangeId} - %-10.10X{camel.routeId} - %m%n +</div></div><h3 id="MDClogging-MDCInformation">MDC Information</h3><p>Camel provides the following context information available for MDC:</p><h4 id="MDClogging-BeforeCamel2.10:">Before Camel 2.10:</h4><p> </p><div class="confluenceTableSmall"><div class="table-wrap"> + <table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Key</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>exchangeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The exchange id</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>messageId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9.1:</strong> The message id</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>correlationId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The correlation id of the exchange if it's correlated. For example a sub message from the <a shape="rect" href="splitter.html">Splitter</a> EIP</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>transactionKey</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The id of the transaction for transacted exchanges. Note the id is not unique, but its the id of the transaction template that marks the transaction boundary for the given transaction. Hence we decided to name the key <code>transactionKey</code> and not <code>transactionID</code> to point out this fact.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>routeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The id of the route, in which the exchange is currently being routed</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>breadcrumbId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> An unique id used for tracking messages across transports.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camelContextId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8.3/2.9:</strong> the camel context id used for tracking the message from different camel context.</p></td></tr></tbody></table> +</div></div><h4 id="MDClogging-FromCamel2.10:">From Camel 2.10:</h4><p> </p><div class="confluenceTableSmall"><div class="table-wrap"> + <table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Key</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camel.exchangeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The exchange id</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camel.messageId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The message id</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camel.correlationId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The correlation id of the exchange if it's correlated. For example a sub message from the <a shape="rect" href="splitter.html">Splitter</a> EIP</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camel.transactionKey</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The id of the transaction for transacted exchanges. Note the id is not unique, but its the id of the transaction template that marks the transaction boundary for the given transaction. Hence we decided to name the key <code>transactionKey</code> and not <code>transactionID</code> to point out this fact.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camel.routeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The id of the route, in which the exchange is currently being routed</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camel.breadcrumbId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>An unique id used for tracking messages across transports.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>camel.contextId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The camel context id used for tracking the message from different camel context.</p></td></tr></tb ody></table> +</div></div><p>The keys are subject to change as we want to align and leverage MDC across other Apache products such as <a shape="rect" class="external-link" href="http://activemq.apache.org">ActiveMQ</a>, <a shape="rect" class="external-link" href="http://servicemix.apache.org/">ServiceMix</a> and <a shape="rect" class="external-link" href="http://karaf.apache.org/">Karaf</a>.</p><h3 id="MDClogging-ExampleUsingLOG4J">Example Using LOG4J</h3><p>If you use log4j you can configure MDC in the <strong><code>log4j.properties</code></strong> file as shown:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="brush: text; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.exchangeId} - %-10.10X{camel.routeId} - %m%n ]]></script> -</div></div> - -<p>Camel will log on startup if MDC is enabled or not</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 SpringCamelContext - - - MDC logging is enabled on CamelContext: camel-1 +</div></div><p>Camel will log on startup if MDC is enabled or not</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="brush: text; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[INFO SpringCamelContext - - - MDC logging is enabled on CamelContext: camel-1 ]]></script> -</div></div> - -<p>The follow snippet is from an unit test which shows MDC in use. Notice the exchange id and route id is displayed in their respective columns in the log file:</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 SpringCamelContext - - - Apache Camel (CamelContext: camel-1) started in 1.228 seconds +</div></div><p>The follow snippet is from an unit test which shows MDC in use. Note that the exchange id and route id are displayed in their separate columns in the log file:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="brush: text; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[INFO SpringCamelContext - - - Apache Camel (CamelContext: camel-1) started in 1.228 seconds INFO foo - 358739-0-2 - route-a - Exchange[ExchangePattern:InOnly, BodyType:String, Body:Hello World] INFO bar - 358739-0-2 - route-b - Exchange[ExchangePattern:InOnly, BodyType:String, Body:Hello World] INFO MockEndpoint - - - Asserting: Endpoint[mock://result] is satisfied ]]></script> -</div></div> - -<h3 id="MDClogging-Usingbreadcrumb">Using breadcrumb</h3> -<p><strong>Available as of Camel 2.8</strong><br clear="none"> -The <code>breadcrumbId</code> key for MDC logging is only available if <code>useBreadcrumb</code> option has been enabled on <a shape="rect" href="camelcontext.html">CamelContext</a> (its default enabled). When enabled Camel will enrich the Camel <a shape="rect" href="message.html">Message</a> by adding a header to it with the key <code>breadcrumbId</code> containing the id. Camel will use the messageId if no existing breadcrumbId was found in the message. By storing the breadcrumb as a header allow us to transport the breadcrumb across transports which supports message body and headers. For example <a shape="rect" href="http.html">HTTP</a> and <a shape="rect" href="jms.html">JMS</a> and many other transports does that.</p> - -<p>If you want to disable breadcrumb you do as follows in Java</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 context = ... +</div></div><h3 id="MDClogging-EnablingBreadcrumbSupport">Enabling Breadcrumb Support</h3><p><strong>From Camel 2.8:</strong><br clear="none"> The <strong><code>breadcrumbId</code></strong> key for MDC logging is only available if <strong><code>useBreadcrumb=true</code></strong> has been set on the <a shape="rect" href="camelcontext.html">CamelContext</a> (default is true). When enabled Camel will enrich the Camel <a shape="rect" href="message.html">Message</a> by adding a header to it with the key <strong><code>breadcrumbId</code></strong> containing the id. Camel will use the <strong><code>messageId</code></strong> if no existing <strong><code>breadcrumbId</code></strong> was found in the message.</p><p>As the breadcrumb id is stored in a header it will persist across any transport that supports the use of headers, for example the <a shape="rect" href="http.html">HTTP</a> and <a shape="rect" href="jms.html">JMS</a> transports.</p><h3 id="MDClogging-DisablingBreadcrumbSup port">Disabling Breadcrumb Support</h3><p>Java DSL:</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 context = ... context.setUseBreadcrumb(false); ... ]]></script> -</div></div> - -<p>And in XML DSL</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[ -<camelContext xmlns="http://camel.apache.org/schema/spring" useBreadcrumb="false"> +</div></div><p>XML DSL:</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[<camelContext xmlns="http://camel.apache.org/schema/spring" useBreadcrumb="false"> ... </camelContext> ]]></script>