Search

Chapter 5. Configuring Logging

download PDF

You can configure logging for the messaging-activemq subsystem by adding a log category in the JBoss EAP logging subsystem for org.apache.activemq and setting the desired log level. You can also configure a log handler for the category to configure how the log messages are recorded.

To see more information in the logs regarding XA transactions, change the log level of the com.arjuna category to a more verbose setting such as TRACE or DEBUG.

For more information on logging, including configuration for categories and other options, see the section on logging in the JBoss EAP Configuration Guide.

Table 5.1. Logging Categories
If you want logs for…​Use this category…​

XA transactions

com.arjuna

All messaging activity

org.apache.activemq

Messaging Journal calls only

org.apache.activemq.artemis.journal

JMS calls only

org.apache.activemq.artemis.jms

Messaging utils calls only

org.apache.activemq.artemis.utils

Messaging core server only

org.apache.activemq.artemis.core.server

Configuring a Client for Logging

Configure messaging clients by following these steps.

  1. Download dependencies to the JBoss JMS client and log manager.

    If you are using Maven, add the following dependencies to your pom.xml file:

    <dependencies>
      ...
      <dependency>
         <groupId>org.jboss.logmanager</groupId>
         <artifactId>jboss-logmanager</artifactId>
         <version>1.5.3.Final</version>
      </dependency>
      <dependency>
          <groupId>org.jboss.eap</groupId>
          <artifactId>wildfly-jms-client-bom</artifactId>
          <type>pom</type>
      </dependency>
      ...
    </dependencies>

    For more information, see the section on using Maven with JBoss EAP in the JBoss EAP Development Guide.

  2. Create a properties file for the logger. Name it logging.properties and save it to a known location. Below is an example properties file. See the section on logging in the JBoss EAP Development Guide for more information on configuring logging options on the client side.

    # Root logger option
    loggers=org.jboss.logging,org.apache.activemq.artemis.core.server,org.apache.activemq.artemis.utils,org.apache.activemq.artemis.journal,org.apache.activemq.artemis.jms,org.apache.activemq.artemis.ra
    
    # Root logger level
    logger.level=INFO
    # Apache ActiveMQ Artemis logger levels
    logger.org.apache.activemq.artemis.jms.level=INFO
    logger.org.apache.activemq.artemis.journal.level=INFO
    logger.org.apache.activemq.artemis.utils.level=INFO
    logger.org.apache.activemq.artemis.core.server.level=INFO
    
    # Root logger handlers
    logger.handlers=FILE
    
    # File handler configuration
    handler.FILE=org.jboss.logmanager.handlers.FileHandler
    handler.FILE.level=FINE
    handler.FILE.properties=autoFlush,fileName
    handler.FILE.autoFlush=true
    handler.FILE.fileName=activemq.log
    handler.FILE.formatter=PATTERN
    
    # Formatter pattern configuration
    formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
    formatter.PATTERN.properties=pattern
    formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c] %s%E%n
  3. Start the client with the expected parameters. When starting your client code using the java command, add the following parameters:

    1. Add the JBoss client and logger JARs to the class path:

      -cp /PATH/TO/jboss-client.jar:/PATH/TO/jboss-logmanager.jar
    2. Enable the JBoss logging manager:

      -Djava.util.logging.manager=org.jboss.logmanager.LogManager
    3. Set the location of the logging properties file:

      -Dlogging.configuration=/PATH/TO/logging.properties

    The full command to start the client will look something like the following example:

$ java -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration=/PATH/TO/logging.properties -cp /PATH/TO/jboss-client.jar:/PATH/TO/jboss-logmanager.jar org.example.MyClient
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.