Chapter 40. Logging

JBM uses standard JDK logging, (a.k.a Java-Util-Logging: JUL), for all its logging. This means we have no dependencies on any third party logging framework. Users can provide their own logging handler to use or alternatively use the log4j handler supplied by JBoss Messaging.

The handlers are configured via the JUL logging.properties file. This default location for this file is under the lib directory found in the Java home directory but it can be overridden by setting the java.util.logging.config.file system property to point to the appropriate logging.properties file. The standalone JBM server does this and the logging.properties file can be found under the config directory of the JBM installation.

By default the standalone server is configured to use the standard console handler and a file handler that logs to bin/logs/messaging.log.

Because some of the third party components used to bootstrap JBoss Messaging, i.e. the Microcontainer, use the JBoss Logging framework we have supplied a plugin class that redirects this to the JUL logger. This is set via a system property, -Dorg.jboss.logging.Logger.pluginClass=org.jboss.messaging.integration.logging.JBMLoggerPlugin. This is only needed when starting the standalone server and is set in the run script. This is not a problem if you are embedding JBoss Messaging in your own code as the Microcontainer won't be being used.

If you want configure your client's logging, make sure you provide a logging.properties file and set the java.util.logging.config.file property on client startup

40.1. Log4j Configuration

JBoss Messaging supplies a JUL Log4j handler that can be used instead of the defaults. To use this simply edit the logging.properties file as such:

handlers=org.jboss.messaging.integration.logging.Log4jLoggerHandler

You will also need to download the Log4j jars and place them in the lib directory and also provide a log4j configuration and place it on the appropriate config directory, i.e. config/common.

40.2. Logging With The JBoss Application Server

When JBoss Messaging is deployed within the Application Server then it will still use JUL however the logging is redirected to the default JBoss logger. For more information on this refer to the JBoss documentation.