So here's a quick summary of the logging saga. In an effort to get JDK
logging and log4j playing together, I integrated the "logbridge" component
which sets up a JDK logging Handler that forwards log messages to log4j.
Version 1.0.0.CR1 worked fine except that it triggered a problem with JSF
where it would crash if the log level was set to too high a detail level.
The way that this version worked was to set JDK logging to a permissive log
level and do the filtering on the log4j "end". Because of this, Stan's
prior fix of setting the log level in the log4j config file no longer
worked. Also, there is a potential performance problem here due to the
fact that the Logger.isLogEnabled(level) method will not accurately reflect
the correct log level, causing possibly costly logging to be done which is
then filtered out by log4j.
Version 1.0.0.CR2 introduced a hook into log4j itself which would update
the JDK log level for each log4j logger in real time. However, due to the
fact that I introduced this hook after the bootstrap phase had started, to
make a long story short ("too late!") the original loggers would suddenly
lose their appenders, thus the "JBoss (Microcontainer) [xxxx] Started in
xx:xx" message (among others) were disappearing (while leaving other
loggers unaffected).
So, the new installment (CR3) goes back to the CR1 idea of simply
installing the handler, with one new feature - the ability to scan the
Log4j loggers and sync up the log levels on the corresponding JDK loggers.
It does so when the logbridge is installed, and again every time the
log4j configuration is updated (via a JMX notification).
In order to facilitate the JMX notification part, I added a
logbridge-jboss-beans.xml to deployers/, which is kind of a sucky place to
add this but I couldn't think of a better one (most of the server stuff is
still JMX-based so there's no likely jboss-beans.xml to add stuff to). If
anyone has any better ideas, let me know - or better yet, just go ahead and
move it. :-)
BTW - new feature idea: what about a JMX annotation that can register its
class as a JMX NotificationListener given an object name?
- DML