[logback-user] Remove appender from SiftingAppender

Ceki Gülcü ceki at qos.ch
Wed Mar 17 17:45:57 CET 2010

Fixed in a recent commit.

On 17/03/2010 3:05 PM, Ceki Gülcü wrote:
> Hello Matthias,
> SiftingAppender tracks appenders with the help of a sub-component called
> AppenderTracker. The tracker will close appenders which have not been
> used in the last 30 minutes. It looks like you need to close the nested
> fike appender immediately without waiting the 30 minutes.
> If you had a handle on the appender tracker, you could instruct it to
> immediately close the nested appender by name. Here is the code:
> AppenderTracer tracer = siftingAppender.getAppenderTracer();
> tracer.stopAndRemoveNow(someName);
> where 'someName' corresponds to the appropriate discriminator value.
> Unfortunately, the getAppenderTracer() in SiftingAppender class and the
> stopAndRemoveNow() method in AppenderTracer do not exist in logback
> 0.9.18. I'll add them shortly to 0.9.19.
> HTH,
> On 17/03/2010 2:10 PM, Matthias Kretschmar wrote:
>> Hi @ all,
>> I have an application handeling commands. Every command is created,
>> executed and deleted at the end.
>> For this, I use a SiftingAppender, with the commandId from the MDC as
>> discriminator.
>> As I understand the concept of the SiftingAppender, it creates a new
>> Appender (in my case FileAppenders that write to seperate folders) for
>> every command, that is created. So far, so good.
>> Now I want to delete my command, inclusive its working directory with
>> its logs. There I get a exception, that the directory cannot be deleted,
>> because files are still in use. I assume, that the logfile cannot be
>> deleted, because the Stream of the FileAppender still is open. Is there
>> a possibility to close the stream. I would prefer a solution, where the
>> FileAppender is closed or detached only by use of slf4j-api. But I
>> believe, that I also have to use logBack in my source code.
>> Until now, I succeeded getting the SiftingAppender, but I couldn't get
>> the FileAppender.
>> Matthias
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user

More information about the Logback-user mailing list