このコンテンツは選択した言語では利用できません。
Chapter 5. Configuring Logging
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.
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.
Download dependencies to the JBoss JMS client and log manager.
If you are using Maven, add the following dependencies to your
pom.xml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow <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>
<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.
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.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Root logger option Root logger level Apache ActiveMQ Artemis logger levels Root logger handlers File handler configuration Formatter pattern configuration
# 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
Start the client with the expected parameters. When starting your client code using the
java
command, add the following parameters:Add the JBoss client and logger JARs to the class path:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -cp /PATH/TO/jboss-client.jar:/PATH/TO/jboss-logmanager.jar
-cp /PATH/TO/jboss-client.jar:/PATH/TO/jboss-logmanager.jar
Enable the JBoss logging manager:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -Djava.util.logging.manager=org.jboss.logmanager.LogManager
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
Set the location of the logging properties file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow -Dlogging.configuration=/PATH/TO/logging.properties
-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
$ 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