You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by James Stauffer <st...@gmail.com> on 2006/10/03 17:05:42 UTC

Re: Problem using AsyncAppender with FallbackErrorHandler

Does it work if you set the FallbackErrorHandler on the AsyncAppender
and the have a second AsyncAppender for the  FileAppender?

On 9/22/06, Srivastava, Satguru <ss...@aegonusa.com> wrote:
>
>
> 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).
>
> 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.
>
> 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.
>
> 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.
>
> 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.
>
> Thanks fro any help.
> Sat
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail:
> log4j-user-help@logging.apache.org
>
>


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


[IGNORE] Re: How to get System.in with log4j

Posted by Luciana dos Santos Lima <lu...@tecgraf.puc-rio.br>.
Sorry about this question.

I already resolve my problem, thanks.

Luciana dos Santos Lima wrote:
> Hi all,
>
> I need to get the user entry (System.in) in my application, but I use 
> ConsoleLogger and I see that I only can set target to System.out or 
> System.err.
> How I can do this?
>
> Thanks in advance.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


How to get System.in with log4j

Posted by Luciana dos Santos Lima <lu...@tecgraf.puc-rio.br>.
Hi all,

I need to get the user entry (System.in) in my application, but I use 
ConsoleLogger and I see that I only can set target to System.out or 
System.err.
How I can do this?

Thanks in advance.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org