blob: d22f9995cf9fb68534bbdaa845a2f8989822d399 [file] [log] [blame]
<div class="wiki-content maincontent"><h2>Logging Interceptor</h2><p>The Logging Interceptor is a pretty trivial <link><page ri:content-title="Interceptors"></page><plain-text-link-body>Interceptor</plain-text-link-body></link> which just logs to <a shape="rect" href="http://jakarta.apache.org/commons/logging/">Jakarta Commons Logging</a> or <a shape="rect" 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 <link><page ri:content-title="How do I change the logging"></page><plain-text-link-body>change it via commons logging or log4j</plain-text-link-body></link>.</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><table><tbody><tr><th colspan="1" rowspan="1"><p><strong>Attribute</strong></p></th><th colspan="1" rowspan="1"><p><strong>Description</strong></p></th><th colspan="1" rowspan="1"><p><strong>Default Value</strong></p></th></tr><tr><td colspan="1" rowspan="1"><p>logAll</p></td><td colspan="1" rowspan="1"><p>Log all Events</p></td><td colspan="1" rowspan="1"><p>false</p></td></tr><tr><td colspan="1" rowspan="1"><p>logConnectionEvents</p></td><td colspan="1" rowspan="1"><p>Events related to connections and sessions</p></td><td colspan="1" rowspan="1"><p>true</p></td></tr><tr><td colspan="1" rowspan="1"><p>logTransactionEvents</p></td><td colspan="1" rowspan="1"><p>Events related to transaction handling</p></td><td colspan="1" rowspan="1"><p>false</p></td></tr><tr><td colspan="1" rowspan="1"><p>logConsumerEvents</p></td><td colspan="1" rowspan="1"><p>Events related to consuming messages</p></td><td colspan="1" rowspan="1"><p>false</p></td></tr><tr><td colspan="1" rowspan="1"><p>logProducerEvents</p></td><td colspan="1" rowspan="1"><p>Events related to producing messages</p></td><td colspan="1" rowspan="1"><p>false</p></td></tr><tr><td colspan="1" rowspan="1"><p>logInternalEvents</p></td><td colspan="1" rowspan="1"><p>Events normally not of Interest for users like failover, querying internal objects etc</p></td><td colspan="1" rowspan="1"><p>false</p></td></tr><tr><td colspan="1" rowspan="1"><p>logSessionEvents</p></td><td colspan="1" rowspan="1"><p>Events related to adding and removing sessions</p></td><td colspan="1" rowspan="1"><p>true</p></td></tr></tbody></table><p>Only connection events logging is enabled by default.</p><p>You can enable the logging interceptor using the following <a shape="rect" 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><structured-macro ac:macro-id="79ddd82e-0753-4eaf-87e4-2f3d0904296c" ac:name="code" ac:schema-version="1"><parameter ac:name="">xml</parameter><plain-text-body>&lt;beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="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"&gt;
&lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/&gt;
&lt;broker useJmx="false" persistent="false" xmlns="http://activemq.apache.org/schema/core"&gt;
&lt;plugins&gt;
&lt;!-- lets enable detailed logging in the broker but ignore ConnectionEvents --&gt;
&lt;loggingBrokerPlugin logAll="true" logConnectionEvents="false"/&gt;
&lt;timeStampingBrokerPlugin zeroExpirationOverride="1000" ttlCeiling="60000" futureOnly="true"/&gt;
&lt;traceBrokerPathPlugin/&gt;
&lt;/plugins&gt;
&lt;/broker&gt;
&lt;/beans&gt;</plain-text-body></structured-macro></div>