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 Evans Mark-PT1167 <Ma...@motorola.com> on 2005/02/10 01:22:15 UTC

guaranteed message delivery, error handler

Cliff notes:
1) How can I do store/forward guaranteed event delivery across a network?

2) What happened to appender error handlers in log4j1.3?

The whole story:
I've been searching the web and log4j mailing lists with limited success.  My ultimate goal is to forward log messages from one machine, over a network, to another machine, without losing messages during periodic network outages.

I've got 3 processes, 2 on a client and one on a server.  The first process (I'll call "event-initiator") generating messages on the client machine, sending them to a Receiver in the second process(I'll call "client-event-receiver") on the same machine.  The "client-event-receiver" needs to forward the messages to the third process (I'll call "server-event-receiver").  If the server-event-receiver is unavailable, the client-event-receiver needs to persist events.  Then when the server-event-receiver is available, forward the persisted events to the server-event-receiver.

I've got a client-event-receiver prototype that logs events locally to hypersonic using 1.3 DBAppender, and also logs events to the server-event-receiver using 1.3 SocketAppender.  However, I need the "smarts" to skip the DBAppender if the SocketAppender is available.  (I'll also need the smarts to read DB messages and forward them to the socket appender if necessary.)  After all that, I'm thinking a JMSAppender on the client may simplify sending events to the server-event-receiver in "recovery mode" (after the SocketAppender recovers from being down).  This still leaves me having to hookup a JMSSink to a SocketAppender in such a manner that if the socket appender is unavailable, it can wait then simply retry.  That leads to the problem, how can the JMSSink write to the appender, but know if the appender is not available, at which time, suspend then retry delivery?  

Well, the ErrorHandler sounds like a good solution.  It's documented in The Complete Log4j Manual.  However, when I browse through the 1.3 source, all the ErrorHandler hooks have been commented out.  I can't find either the OnceOnlyErrorHandler or the FallbackErrorHandler (although there is a javadoc page for OnceOnlyErrorHandler).  They are not in the .jar file and not in the source.  Has the error handler concept in the appender been removed from 1.3?  (Of course there's also the problem of how do I get my primary appender -- socket appender -- back "online" after being suspended via an error handler, but one thing at a time.)

(Side note:  I don't want to have a JMSReceiver at the server-event-receiver receive events from the client-event-receiver because the server-event-receiver would have to be aware of every remote JMS topic and "fetch" messages from it.  I'd rather push messages from the client to the server-event-receiver.  This allows for multiple dynamic transient clients.)

Thanks,
Mark

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