camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > How do I enable streams when debug logging messages in Camel
Date Fri, 11 Sep 2009 08:05:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="http://cwiki.apache.org/confluence/display/CAMEL/How+do+I+enable+streams+when+debug+logging+messages+in+Camel">How
do I enable streams when debug logging messages in Camel</a></h2>
    <h4>Page  <b>added</b> by             <a href="http://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h3><a name="HowdoIenablestreamswhendebugloggingmessagesinCamel-HowdoIenablestreamswhendebugloggingmessagesinCamel"></a>How
do I enable streams when debug logging messages in Camel</h3>
<p><b>Available as of Camel 2.1</b></p>

<p>When you run Camel with <tt>DEBUG</tt> level as logging, it will log
the messages and its content from time to time.<br/>
As some messages can contain streams, which are prone to be not readable multiple times, and
therefore Camel will by default <b>not</b> log these types.</p>

<p>These instances are not logged by default</p>
<ul>
	<li>java.xml.transform.Source</li>
	<li>java.io.InputStream</li>
	<li>java.io.OutputStream</li>
	<li>java.io.Reader</li>
	<li>java.io.Writer</li>
</ul>


<p>You will see this in the log as:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java"> 
DEBUG ProducerCache                  - &gt;&gt;&gt;&gt; Endpoint[direct:start]
Exchange[Message: [Body is instance of java.xml.transform.Source]]
</pre>
</div></div>

<p>Here we have a message which is XML stream based.<br/>
You can customize whether Camel should log the payload anyway.</p>

<h4><a name="HowdoIenablestreamswhendebugloggingmessagesinCamel-CustomizingfromJavaDSL"></a>Customizing
from Java DSL</h4>
<p>You add to the Camel properties the flag to log streams. </p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
        context.getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS, <span class="code-quote">"<span
class="code-keyword">true</span>"</span>);
</pre>
</div></div>

<p>Notice default is <tt>false</tt>.</p>

<h4><a name="HowdoIenablestreamswhendebugloggingmessagesinCamel-CustomizingfromSpringDSL"></a>Customizing
from Spring DSL</h4>
<p>You add to the Camel properties the flag to log streams.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
   <span class="code-tag">&lt;camelContext&gt;</span>
       <span class="code-tag">&lt;properties&gt;</span>
           <span class="code-tag">&lt;property key=<span class="code-quote">"CamelLogDebugBodyStreams"</span>
value=<span class="code-quote">"true"</span>/&gt;</span>
      <span class="code-tag">&lt;/properties&gt;</span>
   <span class="code-tag">&lt;/camelContext&gt;</span>
</pre>
</div></div>

<p>Notice default is <tt>false</tt>.</p>
    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>
       <a href="http://cwiki.apache.org/confluence/display/CAMEL/How+do+I+enable+streams+when+debug+logging+messages+in+Camel">View
Online</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CAMEL/How+do+I+enable+streams+when+debug+logging+messages+in+Camel?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message