[logback-dev] Why ResilientOutputStreamBase does not write the log message after attempt the recovery?

Tom Liu Tom.SH.Liu at MorganStanley.com
Wed Apr 14 04:35:08 CEST 2010


Hi Ceki,

Your explanation is fair enough.

Thank you very much.

Regards,
Tom

On Tue, Apr 13, 2010 at 10:52 PM, Ceki Gülcü <ceki at qos.ch> wrote:
> Hi Tom,
>
> Good question. There is no airtight justification for not wiring the
> message, but I'll try anyway. First, it's OK to lose a message because
> recovery is attempted only for broken channels. If it wasn't for the
> successful attempt, all subsequent messages would be lost too. That
> explains why it's not wrong to return after every recovery attempt
> even successful ones. As for the why, ResilientOutputStream is the
> result of several iterations and the code evolved to its present
> state.
>
> While working on issue LBCORE-148, i.e. refactoring SocketAppender to
> use a resilient stream, returning after recovery attempts proved to be
> quite useful but that was just accidental, not by design.
>
> I hope this answers your question,
>
> On 13/04/2010 10:42 AM, Tom Liu wrote:
>>
>> Hi logback-dev,
>>
>> I wonder why ResilientOutputStreamBase does not try to write the log
>> message after attempt the recovery?
>> What's the consideration here?
>>
>> public void write(byte b[], int off, int len) {
>>     if (isPresumedInError()) {
>>       if (!recoveryCoordinator.isTooSoon()) {
>>         attemptRecovery();
>>       }
>>       return; // return regardless of the success of the recovery attempt
>>     }
>>
>>     try {
>>       os.write(b, off, len);
>>       postSuccessfulWrite();
>>     } catch (IOException e) {
>>       postIOFailure(e);
>>     }
>>   }
>>
>> Thanks very much,
>> Tom
>
>
> _______________________________________________
> logback-dev mailing list
> logback-dev at qos.ch
> http://qos.ch/mailman/listinfo/logback-dev
>


More information about the logback-dev mailing list