NOTE: this information applies only to JBossAS 4.x and 5.x. Starting from 6.x, the logging plugin is no longer selectable inside of JBossAS; however, applications using JBoss libraries can still use the system properties described here to configure logging for their appliaction.
Usage
The choice of the actual logging implementation is determined by the system property. This property specifies the class name of an implementation of the interface. The default value for this is the org.jboss.logging.Log4jLoggerPlugin class.
If you want to use the JDK 1.4+ framework instead of log4j, you can create your own LoggerPlugin to do this. The attached file shows an example implementation.
To use this, specify the following system properties:
To specify the custom JDK1.4 plugin
org.jboss.logging.Logger.pluginClass=logging.JDK14LoggerPlugin
To specify the JDK1.4 logging configuration file
java.util.logging.config.file=logging.properties
This can be done using the JAVA_OPTS env variable, for example:
JAVA_OPTS="-Dorg.jboss.logging.Logger.pluginClass=logging.JDK14LoggerPlugin -Djava.util.logging.config.file=logging.properties"
You need to make your custom Log4jLoggerPlugin available to JBoss by placing it in a jar in the JBOSS_DIST/lib directory, and then telling JBoss to load this as part of the bootstrap libraries by passing in -L jarname on the command line as follows:
$ run.sh -c minimal -L logger.jar
To manage JDK logging, look here JDKLoggerMBean
JBoss 5
JBoss 5 has the JDK logging plugin org.jboss.logging.jdk.JDK14LoggerPlugin in jboss-logging-jdk.jar. So the JAVA_OPTS may be
JAVA_OPTS="-Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.jdk.JDK14LoggerPlugin -Djava.util.logging.config.file=logging.properties"
And that's all.
Comments