camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache Camel > How do I set the max chars when debug logging messages in Camel
Date Mon, 24 Jun 2013 10:15:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/How+do+I+set+the+max+chars+when+debug+logging+messages+in+Camel">How
do I set the max chars when debug logging messages in Camel</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (3)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >*Available as of Camel 2.0* <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >When you run Camel with <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{{DEBUG}}
level as</span> logging, it will log the messages and its content from time to time.
<br></td></tr>
            <tr><td class="diff-unchanged" >As some messages can contain very
big payloads Camel will by default clip the log message and only show the first 1000 chars.
<br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >Here we have a big message that just
contains many numbers. As its based on an unit test we have set a custom limit of 20 chars,
and we have a payload with 1000 chars in total.  <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >You can customize the limit when
Camel clips the body in the <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">DEBUG</span>
log. <br></td></tr>
            <tr><td class="diff-unchanged" >You can use a limit of 0 or negative
to disable it so the entire body is shown. <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">From
*Camel 2.12* onwards, setting a negative value, such as -1, means the message body is not
logged. For earlier Camel versions, you would need to set the value to 1, and have the first
char logged. <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h4. Customizing from Java DSL <br>You
add to the Camel properties the limit. For example to limit at 500 chars: <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h3><a name="HowdoIsetthemaxcharswhendebugloggingmessagesinCamel-HowdoIsetthemaxcharswhendebugloggingmessagesinCamel"></a>How
do I set the max chars when debug logging messages in Camel</h3>
<p><b>Available as of Camel 2.0</b></p>

<p>When you run Camel with logging, it will log the messages and its content from time
to time.<br/>
As some messages can contain very big payloads Camel will by default clip the log message
and only show the first 1000 chars.</p>

<p>You will see this in the log as:</p>
<div class="error"><span class="error">Unknown macro: {code}</span> 
<p>DEBUG ProducerCache                  - &gt;&gt;&gt;&gt; Endpoint<span
class="error">&#91;direct:start&#93;</span> Exchange[Message: 01234567890123456789...
<a href="/confluence/pages/createpage.action?spaceKey=CAMEL&amp;title=Body+clipped+after+20+chars%2C+total+length+is+1000&amp;linkCreation=true&amp;fromPageId=119795"
class="createlink">Body clipped after 20 chars, total length is 1000</a>]</p></div>

<p>Here we have a big message that just contains many numbers. As its based on an unit
test we have set a custom limit of 20 chars, and we have a payload with 1000 chars in total.
</p>

<p>You can customize the limit when Camel clips the body in the log.<br/>
You can use a limit of 0 or negative to disable it so the entire body is shown.</p>

<p>From <b>Camel 2.12</b> onwards, setting a negative value, such as -1,
means the message body is not logged. For earlier Camel versions, you would need to set the
value to 1, and have the first char logged.</p>

<h4><a name="HowdoIsetthemaxcharswhendebugloggingmessagesinCamel-CustomizingfromJavaDSL"></a>Customizing
from Java DSL</h4>
<p>You add to the Camel properties the limit. For example to limit at 500 chars:</p>
<div class="error"><span class="error">Unknown macro: {code}</span> 
<p>        context.getProperties().put(Exchange.LOG_DEBUG_BODY_MAX_CHARS, "500");</p></div>

<h4><a name="HowdoIsetthemaxcharswhendebugloggingmessagesinCamel-CustomizingfromSpringDSL"></a>Customizing
from Spring DSL</h4>
<p>You add to the Camel properties the limit. For example to limit at 500 chars:</p>
<div class="error"><span class="error">Unknown macro: {code}</span> 
<p>   &lt;camelContext&gt;<br/>
       &lt;properties&gt;<br/>
           &lt;property key="CamelLogDebugBodyMaxChars" value="500"/&gt;<br/>
      &lt;/properties&gt;<br/>
   &lt;/camelContext&gt;</p></div>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=CAMEL">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email notification preferences</a>
</div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/How+do+I+set+the+max+chars+when+debug+logging+messages+in+Camel">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=119795&revisedVersion=3&originalVersion=2">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/How+do+I+set+the+max+chars+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