[logback-user] Exception and error safe logging

Ceki Gülcü ceki at qos.ch
Wed Aug 24 18:00:25 CEST 2011


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


More information about the Logback-user mailing list