[logback-dev] [JIRA] Updates for LOGBACK-1673: Unreferenced appenders cause elements containing them to be ignored with logback 1.3.0

QOS.CH (JIRA) noreply-jira at qos.ch
Fri Sep 2 13:03:00 CEST 2022


logback / LOGBACK-1673 [Open]
Unreferenced appenders cause elements containing them to be ignored with logback 1.3.0

==============================

Here's what changed in this issue in the last few minutes.
This issue has been created
This issue is now assigned to you.

View or comment on issue using this link
https://jira.qos.ch/browse/LOGBACK-1673

==============================
 Issue created
------------------------------

Juan Pablo Santos Rodríguez created this issue on 02/Sep/22 12:50 PM
Summary:              Unreferenced appenders cause elements containing them to be ignored with logback 1.3.0
Issue Type:           Bug
Affects Versions:     1.3.0
Assignee:             Logback dev list
Components:           logback-core
Created:              02/Sep/22 12:50 PM
Priority:             Major
Reporter:             Juan Pablo Santos Rodríguez
Description:
  having some sort of configuration like
  
  {code}
  <configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
      <encoder>
        <pattern>[%date{HH:mm:ss.SSS}][%5level][%logger{40}][%msg]%n%rootException</pattern>
      </encoder>
    </appender>
  
  <logger name="org.perrycorp" level="INFO">
      <appender-ref ref="STDOUT" />
      <appender-ref ref="DOES_NOT_EXIST" />
    </logger>
  </configuration>
  {code}
  
  does not apply any appenders to {{org.perrycorp}} logger. Behaviour on 1.2.X was to apply known appenders, ignoring not existing appenders. We have more complex use cases where we define some appenders based on some properties being passed, applying one or another:
  
  {code}
      <logger name="org.perrycorp" level="INFO">
        <if condition='!isNull( "logback.logstash.destinations" )'><then>
          <appender-ref ref="LOGSTASH_APPENDER" />
        </then></if>
  
        <if condition='isNull( "logback.logstash.destinations" )'><then>
          <appender-ref ref="STDOUT" />
        </then></if>
      </logger>
  {code}
  
  in these kind of cases one of the two appenders isn't going to be declared which, with Logback 1.3.0, causes the configuration to not attach any appender to {{org.perrycorp}} logger. Same thing occurs on custom appenders like the one noted on LOGBACK-551.
  
  Workaround for the last case is to provide dummy appenders and overwrite instead of define the appenders inside the corresponding {{<if>}} elements (doable but not funny for us, so we'd appreciate if the old behaviour could be brought back)
  


==============================
 This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)



More information about the logback-dev mailing list