| <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[<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"> |
| <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/> |
| <broker useJmx="false" persistent="false" xmlns="http://activemq.apache.org/schema/core"> |
| <plugins> |
| |
| <!-- lets enable detailed logging in the broker but ignore ConnectionEvents --> |
| <loggingBrokerPlugin logAll="true" logConnectionEvents="false"/> |
| |
| <timeStampingBrokerPlugin zeroExpirationOverride="1000" ttlCeiling="60000" futureOnly="true"/> |
| <traceBrokerPathPlugin/> |
| |
| </plugins> |
| </broker> |
| </beans>]]></script> |
| </div></div></div> |
| |