camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Log
Date Thu, 16 Jul 2009 12:34: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/Log">Log</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <h2><a name="Log-LogComponent"></a>Log Component</h2>

<p>The <b>log:</b> component logs message exchanges to the underlying logging
mechanism.</p>

<p>Camel uses <a href="http://commons.apache.org/logging/" rel="nofollow">commons-logging</a>
which allows you to configure logging via </p>

<ul>
	<li><a href="http://logging.apache.org/log4j/" rel="nofollow">Log4j</a></li>
	<li><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/package-summary.html"
rel="nofollow">JDK 1.4 logging</a></li>
	<li>Avalon</li>
	<li>SimpleLog - a simple provider in commons-logging</li>
</ul>


<p>Refer to the <a href="http://commons.apache.org/logging/commons-logging-1.1.1/guide.html"
rel="nofollow">commons-logging user guide</a> for a more complete overview of how
to use and configure commons-logging.</p>


<h3><a name="Log-URIformat"></a>URI format</h3>

<style type="text/css">
@import url(/confluence/download/resources/confluence.ext.code:code/shStyles.css);
</style>
<!--[if IE]>
<style type="text/css">
    .code textarea, .code input { padding: 0 !important; }
</style>
<![endif]-->
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shCore.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushCSharp.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushPhp.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushJScript.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushVb.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushSql.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushXml.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushShell.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushDelphi.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushPython.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushJava.js"></script>
<div class="code">
<textarea name="newcodemacro" class="java:nocontrols:nogutter" rows="10" readonly="readonly">log:loggingCategory[?level=loggingLevel][options]</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>


<p>Where <b>loggingCategory</b> is the name of the logging category to use
and <b>loggingLevel</b> is the logging level such as DEBUG, INFO, WARN, ERROR
- the default is INFO</p>

<p>By default Camel uses a regular logging that logs every exchange. However Camel also
ships with a Throughput logger that is used if the <tt>groupSize</tt> option is
specified.</p>

<h3><a name="Log-Options"></a>Options</h3>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Option </th>
<th class='confluenceTh'> Default </th>
<th class='confluenceTh'> Type </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> level </td>
<td class='confluenceTd'> INFO </td>
<td class='confluenceTd'> String </td>
<td class='confluenceTd'> Logging level to use. Possible values: FATAL, ERROR, WARN,
INFO, DEBUG, TRACE, OFF </td>
</tr>
<tr>
<td class='confluenceTd'> groupSize </td>
<td class='confluenceTd'> null </td>
<td class='confluenceTd'> Integer </td>
<td class='confluenceTd'> An integer that specifies a group size for throughput logging.
By default regular logging is used. </td>
</tr>
</tbody></table>

<h3><a name="Log-Formatting"></a>Formatting</h3>
<p>The log formats the execution of exchanges to log lines. <br/>
The log uses by default <tt>LogFormatter</tt> to format the log output.</p>

<p>LogFormatter has the following options:</p>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Option </th>
<th class='confluenceTh'> Default </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> showAll </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> quick option for turning all options on </td>
</tr>
<tr>
<td class='confluenceTd'> showExchangeId </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> To output the unique exchange id </td>
</tr>
<tr>
<td class='confluenceTd'> showProperties </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> Output the exchange properties </td>
</tr>
<tr>
<td class='confluenceTd'> showHeaders </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> Output the in message headers </td>
</tr>
<tr>
<td class='confluenceTd'> showBodyType </td>
<td class='confluenceTd'> true </td>
<td class='confluenceTd'> Output the in body Java type </td>
</tr>
<tr>
<td class='confluenceTd'> showBody </td>
<td class='confluenceTd'> true </td>
<td class='confluenceTd'> Output the in body </td>
</tr>
<tr>
<td class='confluenceTd'> showOut </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> If the exchange has an out message then its also shown </td>
</tr>
<tr>
<td class='confluenceTd'> showException </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> <b>Camel 2.0:</b> If the exchange has an exception
then the exception message is shown (no stacktrace) </td>
</tr>
<tr>
<td class='confluenceTd'> showStackTrace </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> <b>Camel 2.0:</b> Show also the stacktrace if
the exchange has an exception </td>
</tr>
<tr>
<td class='confluenceTd'> multiline </td>
<td class='confluenceTd'> false </td>
<td class='confluenceTd'> if <b>enabled</b> then each information is logged
on a new line </td>
</tr>
<tr>
<td class='confluenceTd'> maxChars </td>
<td class='confluenceTd'>&nbsp;</td>
<td class='confluenceTd'> <b>Camel 2.0:</b> Is used to limit the number
of chars logged per line. </td>
</tr>
</tbody></table>

<h3><a name="Log-Regularloggersample"></a>Regular logger sample</h3>
<p>In the route below we logs the incoming orders at DEBUG level before the order is
processed.</p>
<div class="code">
<textarea name="newcodemacro" class="java:nocontrols:nogutter" rows="10" readonly="readonly">from("activemq:orders").to("log:com.mycompany.order?level=DEBUG").to("bean:processOrder");</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>


<p>And using Spring DSL as the route:</p>
<div class="code">
<textarea name="newcodemacro" class="xml:nocontrols:nogutter" rows="10" readonly="readonly">&lt;route&gt;
    &lt;from uri="activemq:orders"/&gt;
    &lt;to uri="log:com.mycompany.order?level=DEBUG"/&gt;
    &lt;to uri="bean:processOrder"/&gt;
  &lt;/route&gt;</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>


<h3><a name="Log-Regularloggerwithformattersample"></a>Regular logger with
formatter sample</h3>
<p>In the route below we logs the incoming orders at INFO level before the order is
processed.</p>
<div class="code">
<textarea name="newcodemacro" class="java:nocontrols:nogutter" rows="10" readonly="readonly">from("activemq:orders").
    to("log:com.mycompany.order?showAll=true&amp;multiline=true").to("bean:processOrder");</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>


<h3><a name="Log-Throughputloggersample"></a>Throughput logger sample</h3>
<p>In the route below we log the throughput of the incoming orders at DEBUG level grouped
by 10 messages.</p>
<div class="code">
<textarea name="newcodemacro" class="java:nocontrols:nogutter" rows="10" readonly="readonly">from("activemq:orders").
    to("log:com.mycompany.order?level=DEBUG?groupSize=10").to("bean:processOrder");</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>


<h3><a name="Log-SeeAlso"></a>See Also</h3>
<ul>
	<li><a href="/confluence/display/CAMEL/Configuring+Camel" title="Configuring Camel">Configuring
Camel</a></li>
	<li><a href="/confluence/display/CAMEL/Component" title="Component">Component</a></li>
	<li><a href="/confluence/display/CAMEL/Endpoint" title="Endpoint">Endpoint</a></li>
	<li><a href="/confluence/display/CAMEL/Getting+Started" title="Getting Started">Getting
Started</a></li>
</ul>

<ul>
	<li><a href="/confluence/display/CAMEL/Tracer" title="Tracer">Tracer</a></li>
	<li><a href="/confluence/display/CAMEL/How+do+I+use+log4j" title="How do I use log4j">How
do I use log4j</a></li>
	<li><a href="/confluence/display/CAMEL/How+do+I+use+Java+1.4+logging" title="How
do I use Java 1.4 logging">How do I use Java 1.4 logging</a></li>
</ul>



     </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/Log">View Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=63040&revisedVersion=14&originalVersion=13">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CAMEL/Log?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message