blob: 0175cb95e76c3ea83fde62356fff7104a4f56309 [file] [log] [blame]
<div class="wiki-content maincontent"><h2 id="LoggingInterceptor-LoggingInterceptor">Logging Interceptor</h2><p>The Logging Interceptor is a pretty trivial <a shape="rect" href="interceptors.xml">Interceptor</a> which just logs to <a shape="rect" class="external-link" href="http://jakarta.apache.org/commons/logging/">Jakarta Commons Logging</a> or <a shape="rect" class="external-link" href="http://logging.apache.org/log4j/docs/">log4j</a> as messages are sent or acknowledged on a broker.</p><p>The default logging level used is <strong>INFO</strong>. If you want to increase/reduce the logging you can use <a shape="rect" href="how-do-i-change-the-logging.xml">change it via commons logging or log4j</a>.</p><p>As of version 5.3 the logging Interceptor is more configurable. The idea is to log all events but be able to turn off logging for certain event groups by configuration.</p><p>Currently the following groups are supported:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p><strong>Attribute</strong></p></th><th colspan="1" rowspan="1" class="confluenceTh"><p><strong>Description</strong></p></th><th colspan="1" rowspan="1" class="confluenceTh"><p><strong>Default Value</strong></p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>logAll</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Log all Events</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>logConnectionEvents</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Events related to connections and sessions</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>true</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>logTransactionEvents</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Events related to transaction handling</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>logConsumerEvents</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Events related to consuming messages</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>logProducerEvents</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Events related to producing messages</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>logInternalEvents</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Events normally not of Interest for users like failover, querying internal objects etc</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>logSessionEvents</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Events related to adding and removing sessions</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>true</p></td></tr></tbody></table></div><p>Only connection events logging is enabled by default.</p><p>You can enable the logging interceptor using the following <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/activemq/trunk/activemq-unit-tests/src/test/resources/org/apache/activemq/util/plugin-broker.xml">XML configuration</a>. This example enables all logging and disables the connection event logging:</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[&lt;beans
xmlns=&quot;http://www.springframework.org/schema/beans&quot;
xmlns:amq=&quot;http://activemq.apache.org/schema/core&quot;
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd&quot;&gt;
&lt;bean class=&quot;org.springframework.beans.factory.config.PropertyPlaceholderConfigurer&quot;/&gt;
&lt;broker useJmx=&quot;false&quot; persistent=&quot;false&quot; xmlns=&quot;http://activemq.apache.org/schema/core&quot;&gt;
&lt;plugins&gt;
&lt;!-- lets enable detailed logging in the broker but ignore ConnectionEvents --&gt;
&lt;loggingBrokerPlugin logAll=&quot;true&quot; logConnectionEvents=&quot;false&quot;/&gt;
&lt;timeStampingBrokerPlugin zeroExpirationOverride=&quot;1000&quot; ttlCeiling=&quot;60000&quot; futureOnly=&quot;true&quot;/&gt;
&lt;traceBrokerPathPlugin/&gt;
&lt;/plugins&gt;
&lt;/broker&gt;
&lt;/beans&gt;]]></script>
</div></div></div>