[logback-dev] WriterAppender.subAppend behaviour in case of IOExceptions
Syvalta
syvalta at yahoo.com
Tue Oct 13 16:37:51 CEST 2009
Hi,
I noticed WriterAppender.subAppend stops appending if an IOException occurs
during write. This is bit problematic if interruption is used as a
cancellation mechanism (as suggested in JCiP). The problem is that if a
thread happens to be logging at the time it is interrupted, logging (for
that appender) will be ceased for the lifetime of the application (or until
Logback is re-initialized). Additionally, if there are some transient
errors, logging won't continue after recovery. At least it seems so, but I
might be wrong.
I could provide a patch which changes the behavior, but it seems changes are
non-trivial. I would be glad to receive some advice.
- how backward compatible the changes should be? Can I remove methods, add
abstract methods etc. or should backward compatibility be preserved (and if
it is, does that increase the likelihood of the patch being applied)?
- in what level at hierarchy this should be done? I have thought at
WriterAppender, but that would require adding a method to create
OutputStream, which subclasses would implement. Currently subclasses set
writer to WriterAppender, so this would change it to the opposite. Another
option would be to do it at FileAppender level, but I haven't investigated
that option much yet.
- should there be some "throttling", so that under persistent error state
new outputstream would not be tried to be created in every logging call. I
think so, perhaps some condition like "try in first 10 calls, but after that
only every 30 sec).
- should the log events be buffered under presence of error (of course
limited amount with fifo or something)?
- is there any chance that this kind of patch would be accepted? Do you see
this kind of feature useful?
Hope you understand at least something from my post, I admit it is "bit"
unclear :)
--
View this message in context: http://www.nabble.com/WriterAppender.subAppend-behaviour-in-case-of-IOExceptions-tp25874122p25874122.html
Sent from the Logback Dev mailing list archive at Nabble.com.
More information about the logback-dev
mailing list