qos-ch / logback

The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
Other
3.02k stars 1.29k forks source link

Appenders are created even if their only reference is inside of another appender that does not get referenced #806

Open Falmarri opened 7 months ago

Falmarri commented 7 months ago
    <appender name="inner" class="ch.qos.logback.core.rolling.RollingFileAppender">
    </appender>
    <appender name="outer" class="net.logstash.logback.appender.LoggingEventAsyncDisruptorAppender">
        <appender-ref ref="inner" />
    </appender>

Using this configuration, the RollingFileAppender gets instantiated even if the LoggingEventAsyncDisruptorAppender doesn't. This is problematic because I only ever reference the Async appender via flags that get evaluated via conditions in environments where the RollingFileAppender has permissions to create the files its referencing.

This works when using the deprecated method of nested appenders

ceki commented 6 months ago

@Falmarri Which version of logback are you using?