Details
-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
1.0.13
Description
We have a sifting appender (example below) that has a short timeout window in addition to a filter.
Our issue is that the appenders created by the sifter are only being removed when stale if a logging statement makes it through the filter, and hence to SiftingAppenderBase.append().
As this sifter rarely allows logging statements through (our real filter is very restrictive) we sometimes have stale appenders that are open for days.
While we could certainly poke through the AppenderTracker every so often, what about adding optional functionality that would spin up a thread for all SiftingAppenders and at X (configurable) frequency check for, close and remove any stale appenders (such as with AbstractComponentTrackker.removeStaleComponents()).
<appender name="trace" class="ch.qos.logback.classic.sift.SiftingAppender"> <timeout>2 minutes</timeout> <maxAppenderCount>100</maxAppenderCount> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>INFO</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <sift> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>log.log</file> <append>true</append> <encoder> <pattern>%d{MM-dd-yyyy:HH:mm:ss.SSS} [%thread] %-5level %logger{10}->%method\(\):%line r:%X{reqId} S:%X{site} U:%X{user} - %msg%n</pattern> <immediateFlush>false</immediateFlush> </encoder> </appender> </sift> </appender>