It seems like Log4j is designed to not propagate sink (appender) related
errors to the caller. This makes sense because internal logging behaviour
shouldn't normally interfere with the program's natural execution path. In
other words; adding logging to an application should in general _not_ alter
the behavior of the program. The ErrorHandler concept is added for having a
generic way of handling appender internal errors, you may, as you indicate,
trigger a backup appender, or notify a possible listener.

I could be arrested on this, but it seems like unchecked (runtime/error)
exceptions will silently traverse the call stack when a log event is
triggered. This means that you, upon error occurrence in an appender, can
throw an unchecked exception which could be caught by the event originator.
I wouldn't recommend this, however, because it's easily broken if the actual
appending is done in another thread, which e.g. is the case when you use an
AsyncAppender.

I think an intelligent ErrorHandler is the way to go for you.

--

Thomas



| -----Original Message-----
| From: Tumpach, Andrew J [mailto:[EMAIL PROTECTED]]
| Sent: 27 June 2002 17:44
| To: Log4J Users List; [EMAIL PROTECTED]
| Subject: RE: Exception propagation
|
|
| I'm not sure how that would help?  The caller needs to be able to
| determine what the exception was and respond to it.  How will a
| customized ErrorHandler do this?  We still couldn't propagate the
| exception, so I don't see how this will achieve anything beyond
| what setting a backup appender would.  Please let me know if I'm
| misunderstanding your suggestion.
|
| Andrew
|
| -----Original Message-----
| From: Thomas Tuft Muller [mailto:[EMAIL PROTECTED]]
| Sent: Thursday, June 27, 2002 10:43 AM
| To: Log4J Users List
| Subject: RE: Exception propagation
|
|
| Do you think you can use a customized ErrorHandler? See
| org.apache.log4j.spi.ErrorHandler. Note that ErrorHandlers can only be
| configured via DOMConfigurator.
|
| --
|
| Thomas
|
|
| | -----Original Message-----
| | From: Tumpach, Andrew J [mailto:[EMAIL PROTECTED]]
| | Sent: 27 June 2002 16:42
| | To: [EMAIL PROTECTED]
| | Subject: RE: Exception propagation
| |
| |
| | Does anyone have any thoughts on this?
| |
| | Andrew
| |
| | -----Original Message-----
| | From: Tumpach, Andrew J
| | Sent: Tuesday, June 25, 2002 3:22 PM
| | To: '[EMAIL PROTECTED]'
| | Subject: Exception propagation
| |
| |
| | I understand why in some cases it's a benefit that Log4J doesn't
| | propagate exceptions, however, in our case, we are using Log4J to
| | do auditing.  The fact that we won't receive an exception if a
| | logging call fails is important.  Any thoughts on how to get
| | around this?  I can't see a way, without some rather drastic
| | rewriting of Log4J code.
| |
| | P.S. I wonder whether making exception propagation configurable
| | would be possible in the near future...?
| |
| | Thanks,
| | Andrew
| |
| |
| | --
| | To unsubscribe, e-mail:
| | <mailto:[EMAIL PROTECTED]>
| | For additional commands, e-mail:
| | <mailto:[EMAIL PROTECTED]>
| |
| |
|
|
|
| *************************************************************************
| Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All rights reserved.
| The information supplied in this email should be treated in confidence.
| No liability whatsoever is accepted for any loss or damage
| suffered as a result of accessing this message or any attachments.
|
| ________________________________________________________________________
| This email has been scanned for all viruses by the MessageLabs SkyScan
| service. For more information on a proactive anti-virus service working
| around the clock, around the globe, visit http://www.messagelabs.com
| ________________________________________________________________________
|
| --
| To unsubscribe, e-mail:
| <mailto:[EMAIL PROTECTED]>
| For additional commands, e-mail:
| <mailto:[EMAIL PROTECTED]>
|
|
| --
| To unsubscribe, e-mail:
| <mailto:[EMAIL PROTECTED]>
| For additional commands, e-mail:
| <mailto:[EMAIL PROTECTED]>
|
|



*************************************************************************
Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All rights reserved. 
The information supplied in this email should be treated in confidence.
No liability whatsoever is accepted for any loss or damage 
suffered as a result of accessing this message or any attachments.

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

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

Reply via email to