Deploying our application on the JBoss 6.0.0 application server we encounter the following NullPointerException (NPE) also logged in the
log\server.log file:
2011-03-17 12:52:18,269 ERROR
[filenet_error.engine.com.filenet.engine.tasks.TaskManager]
(TaskManager$RootTask_RootTask_ScheduledPoolExecutor_9)
TaskManager$RootTask:RootTask running with error , with message null:
java.lang.NullPointerException
at org.jboss.logmanager.log4j.LevelMapping.getLevelFor(LevelMapping.java:65) [:6.0.0.Final]
at org.jboss.logmanager.log4j.BridgeLogger.setPriority(BridgeLogger.java:199) [:6.0.0.Final]
at org.jboss.logmanager.log4j.BridgeLogger.setLevel(BridgeLogger.java:194) [:6.0.0.Final]
at com.filenet.engine.util.Logger.removeTraceLoggerLevel(Logger.java:377)
...
The com.filenet.engine.util.Logger.removeTraceLoggerLevel method executes the following two lines of code:
org.apache.log4j.Logger traceLogger = getLog4JTraceLogger(subsystem, traceFlag);
traceLogger.setLevel(null);
Note the setLevel method is passing in a null parameter value (supported by org.apache.log4j.Logger.setLevel) to remove the specified logging level. We've verified that the JBoss LevelMapping.getLevelFor method throws the NPE as a result of the null parameter value passed into setLevel (changing the parameter value to another level (e.g. Level.DEBUG) eliminates the exception). The setLevel(null) code executed with no exceptions in JBoss 5.1.0 and earlier versions of the server and is supported by org.apache.log4j.Logger.setLevel.
It appears that the logging mechanism has changed significantly in JBoss 6.0, there is now a BridgeLogger class that extends the
org.apache.log4j.Logger class providing the implementation of the setLevel method. That implementation appears to have omitted
support for "null" as a parameter value and causes the NPE. Further testing indicates that the Level.OFF value is also not supported either - leaving no way to remove the logging level.
We would like to see support for "null" and Level.OFF added to the BridgeLogger extension of Logger.