[logback-dev] [JIRA] Created: (LBCLASSIC-316) SiftingAppender and the lifecycle of created appenders

Guus Bloemsma (JIRA) noreply-jira at qos.ch
Thu Jan 5 12:43:26 CET 2012


SiftingAppender and the lifecycle of created appenders
------------------------------------------------------

                 Key: LBCLASSIC-316
                 URL: http://jira.qos.ch/browse/LBCLASSIC-316
             Project: logback-classic
          Issue Type: Improvement
          Components: appender
    Affects Versions: 1.0.0
         Environment: servlet container
            Reporter: Guus Bloemsma
            Assignee: Logback dev list


I'm using SiftingAppender to create logfiles per servlet request. I wrote a servlet filter to add session and request id's into MDC. A custom appender (nested into SiftingAppender) buffers all logging events. Only when a WARN or ERROR occurred it writes all of them at the end of the servlet request to yet another nested appender. Logback made this surprisingly easy!

This all works fine except for one little problem. The SiftingAppender creates a new custom appender for each request. It uses a AppenderTrackerImpl to keep track of them. That AppenderTrackerImpl holds on to those appenders for half an hour even though it is guaranteed that they won't be needed after the request. That is a lot of unused appenders!

Being able to configure that timeout per SiftingAppender would be one solution.

Another way would be to make the method ch.qos.logback.core.sift.AppenderTrackerImpl.isEntryStale(Entry, long) check whether the appender in the entry is stopped. In that case it should be treated as stale as well. My custom appender would simply stop itself once it is no longer used.

BTW, I understand that I'm kind of abusing SiftingAppender. Maybe I should just make my own...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list