• Post Reply Bookmark Topic Watch Topic
  • New Topic

detcting log4j server  RSS feed

 
Sachin Mehta
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using log4j to log messages. In my implementation , I have a situation
where if the log4j server is down I need to take an action accordingly. I tried this by catching Throwable while getting the Logger i.e. Logger.getLogger(String name), but the catch block never gets executed.
I have used socket appender for the logger.
Expecting some good replies,
Thanks in advance.
Sachin
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, since the getLogger() method of org.apache.log4j.Logger does not throw anything useful, you will not be able to catch anything. Second, as the javadoc for org.apache.log4j.net.SocketAppender notes:

If the remote server is down, the logging requests are simply dropped.

Since it presumes success, at least from the client's side, it will be difficult to use SocketAppender to determine if the server is up or down.
[ December 29, 2003: Message edited by: Joe Ess ]
 
Sean Sullivan
Ranch Hand
Posts: 427
 
Sachin Mehta
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sean,
Thanks for the info. I do agree that ErrorHandler can be used for such cases. Unfortunately, I have not been able to use a user defined handler.
Can you please provide me more insights (if possible, a step-by-step information) about how to use user defined handlers other than what the API provides ?
Thanks,
Sachin.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!