At 08:12 PM 1/10/2005, Oscar Inostroza wrote:
Thanks for the prompt answer Ceki,

I really enjoyed reading your book, I used log4j in
the past but I didn't realize until I read your book
that log4j offers a lot of functionality that I wasn't
aware of.

Thank you. I am glad you enjoyed reading it.

Well it's good to know that the ErrorHandler will not
be supported in future log4j releases. I guess that
leaves me with no failover provided by log4j.

An option would be to implement a fallback socket
appender and modifying my application to test the
connection to the log server before every single log
event. This will provide failover and fallback at
runtime (which is what I precisly want) but on the
other hand this will not be efficient at all and will
slow down the application in general.

Do you have any advice on how to implement failover
using log4j Socket appenders?

SocketAppender already implements one kind of error recovery strategy. If a connection to the server host is down, it will try to reconnect every 30 seconds. You can tweak this period with the setReconnectionDelay option.

If you have two servers running, a primary and a secondary. You can
modify SocketAppender to connect to the primary server, and if that
fails, try the secondary. Just have a look at the code. The
enhancement should not be too difficult to do.


Thanks again,
Oscar

-- Ceki G�lc�

  The complete log4j manual: http://www.qos.ch/log4j/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to