[logback-user] Exception and error safe logging

Adam Fitzgerald afitz at gatech.edu
Fri Aug 26 15:05:28 CEST 2011


Thanks for the quick reply!

What are the chances of this being changed (or a change being
accepted) to catch errors as well?

My understanding is that there is logic being done from the Logger
logging methods, before the Appenders are invoked. Would it make more
sense for us to wrap these methods, to give as strong a 'guarantee' as
possible that we will not throw?

Thanks again,
Adam


On Wed, Aug 24, 2011 at 12:00 PM, Ceki Gülcü <ceki at qos.ch> wrote:
>
> Checking up on this, the AppenderBase and UnsynchronizedAppenderBase classes
> catch all instances java.lang.Exception and derivatives but not
> java.land.Error.
>
> At present time, you would need to handle OutOfMemoryError on your own.
>
> Sorry for the bs in my previous message.
>
> On 24/08/2011 5:53 PM, Ceki Gülcü wrote:
>>
>> On 24/08/2011 4:14 PM, Adam Fitzgerald wrote:
>>>
>>> Hello,
>>>
>>> For a project I'm working on we would like to be able to attempt
>>> recovery after the occurrence exceptions and some errors, and are
>>> investigating methods of integrating the use of logback into this
>>> strategy. In the case of exceptions, does logback make any guarantee
>>> about what will/won't be thrown from the message logging methods? Is
>>> there anything like a 'safe' logging API that will not throw?
>>
>> Logback will never throw exceptions visible at the application layer.
>>
>>> Secondly we want to catch OOM errors that may occur in a call to
>>> logback. The simplest (but tedious) approach would be to wrap the
>>> calls in a try-catch block. Alternatively we are considering proxying
>>> the logger and wrapping the calls to the real logger in a try catch
>>> within the proxy. Can anyone forsee any issues with doing this? Does
>>> any kind of functionality like this already exist?
>>
>> That includes OOM.
>>
>>> Thanks in advance,
>>> Adam
>
>
> --
> QOS.ch, main sponsor of cal10n, logback and slf4j open source projects, is
> looking to hire talented software developers. For further details, see
> http://logback.qos.ch/job.html
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
>


More information about the Logback-user mailing list