Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1673

Unreferenced appenders cause elements containing them to be ignored with logback 1.3.0

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.4.2, 1.3.2
    • 1.3.0
    • logback-core
    • None

    Description

      having some sort of configuration like

      <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>
      

      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:

          <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>
      

      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)

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            juanpablo Juan Pablo Santos Rodríguez
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: