I am having problem using AsyncAppender with the
FallbackErrorHandler.
I have
a) a AsyncAppender attached to the root logger.
b) a JMSAppender attached to the AsyncAppender.
c) a FallbackErrorHandler attached to the JMSAppender. The FallbackErrorHandler specifies the root as a logger (using root-ref tag) and a FileAppender as the fallback appender (using appender-ref tag).
a) a AsyncAppender attached to the root logger.
b) a JMSAppender attached to the AsyncAppender.
c) a FallbackErrorHandler attached to the JMSAppender. The FallbackErrorHandler specifies the root as a logger (using root-ref tag) and a FileAppender as the fallback appender (using appender-ref tag).
Now when an error occurs, the the
FallbackErrorHandler tries to replace the JMSAppender with the FileAppender in
the root logger! (rather than in the
AsyncAppender).
Unfortunately this does not help, as the root logger keeps sending messages to the AsyncAppender which then forwards them to the failing JMSAppender.
Unfortunately this does not help, as the root logger keeps sending messages to the AsyncAppender which then forwards them to the failing JMSAppender.
Is this a bug or am I doing something
wrong?
If this is a bug then ,I think, the
FallbackErrorHandler should be modified to check each of the loggers, specified
to it , to see if any of them have a AsyncAppender attached.
If it finds one then it should try to switch the primary and backup appender in that AsyncAppender rather than in the logger.
If it finds one then it should try to switch the primary and backup appender in that AsyncAppender rather than in the logger.
I got around my issue by modifying the
FallbackErrorHandler to do just that.
Could somebody look at the new code and let me know if this was really required and if yes then if the changes I made are appropriate
Attached is the new code.
Could somebody look at the new code and let me know if this was really required and if yes then if the changes I made are appropriate
Attached is the new code.
I added a new method called "private void
removeFromAsync(Logger l)" and modified the
"public void error(String message, Exception e, int errorCode, LoggingEvent event)" to call this new method for each logger.
"public void error(String message, Exception e, int errorCode, LoggingEvent event)" to call this new method for each logger.
Thanks fro any help.
Sat
Sat
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
