JDK Logging in JBoss 5.1

Recently I migrated JDK logging on JBoss 5.1.

 

As per the JBoss documentation JDK logging should work as long as two parameters mentioned below are set i.e.

set JAVA_OPTS=%JAVA_OPTS% -Dorg.jboss.logging.Logger.pluginClass=org.jboss.logging.jdk.JDK14LoggerPlugin

set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.config.file=%AIRCORE_HOME%\Properties\logging.properties

but unfortunately it didn’t work for me.

 

Later I realized JBoss AS 5.1.x includes a logging bridge between java.util.logging and log4j and if you want control JDK logging level, use following configuration

<category name="javax.enterprise.resource.webcontainer.jsf">

<priority value="FINE" class="org.jboss.logging.log4j.JDKLevel"/>

</category>

 

The jdk logging levels can be controlled through the org.jboss.logging.log4j.JDKLevel class that in addition to the standard log4j levels it adds support for SEVERE, WARNING, CONFIG, FINE, FINER, FINEST

 

This configuration in jboss-log4j.xml enables jdk logging to work with log4j.

 

This works fine as long as standard JDK logging is used but if you have built custom Formatter, Levels etc. It may not reflect because the configuration file in effect is jboss-log4j.xml.

Configuration defined in logging.properties are neither read nor reflected in the logging, though it is set as described above.

 

Later when went through code, I found, it is using JBoss LogManager (org.jboss.LogManager) by default. This doesn’t read logging configuration from Djava.util.logging.config.file property.

So to use java.util.LogManager set following proeprty

 

set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=java.util.logging.JDKLogManager

 

This will force to use standard JDK logging.