]
David Lloyd updated JBAS-9318:
------------------------------
Assignee: (was: David Lloyd)
BridgeLogger doesn't support addAppender, getAppender and other
methods available to a log4j Logger
---------------------------------------------------------------------------------------------------
Key: JBAS-9318
URL:
https://issues.jboss.org/browse/JBAS-9318
Project: Application Server 3 4 5 and 6
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Logging
Affects Versions: 6.0.0.Final
Reporter: Richard Robinson
The JBoss 6 BridgeLogger is missing some functionality of the log4j Logger class that our
app needs to dynamically reconfigure the logger. We need this primarily because we want to
send error logging to only an error appender if tracing if off and, if tracing is on, we
want to send error logging to both an error appender and also to the trace appender. The
idea is that the error log always only shows errors and that the trace log will show both
tracing and errors.
To make this work programmatically we use the Logger getAllAppenders, getAppender,
setAppender, removeAppender and setLevel calls. Unfortunately, only the setLevel call
seems to work in the current BridgeLogger implementation and the other methods apparently
do nothing.
Although we are using the log4j API, it might be helpful to illustrate the configuration
in jboss-logging.xml terms. We want to be able to set up a configuration that is
effectively like this if tracing is off:
{code:xml}
<logger category="errors">
<handlers>
<handler-ref name="CONSOLE"/>
<handler-ref name="ERROR"/>
</handlers>
</logger>
<logger category="tracing">
<level name="OFF"/>
<handlers>
<handler-ref name="TRACING"/>
</handlers>
</logger>
{code}
So if tracing is turned off, the error logger goes to the error appender/handler and the
console.
However, if tracing is turned on. We want to dynamically set to something like this
(again this is in effective jboss-logging.xml terms... we actually do make the changes
using the log4j API):
{code:xml}
<logger category="errors">
<handlers>
<handler-ref name="CONSOLE"/>
<handler-ref name="ERROR"/>
<handler-ref name="TRACING"/>
</handlers>
</logger>
<logger category="tracing">
<level name="DEBUG"/>
<handlers>
<handler-ref name="TRACING"/>
</handlers>
</logger>
{code}
The difference is that now the error logger now has a new appender/handler for TRACING
which wasn't there for the tracing off case. Also the tracing logger is now set to
level DEBUG.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: