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

Nested Appenders within AsyncAppender no longer work

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.4.2, 1.3.2
    • 1.3.0, 1.4.0
    • None
    • None

    Description

      Previously in older versions of logback the following was valid:

       

       

      <configuration>
          <appender name="STDOUT-ASYNC" class="ch.qos.logback.classic.AsyncAppender">
              <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
                  <encoder class="com.foo.SomeEncoder"/>
              </appender>
          </appender>    
          <root level="${ROOT_LOG_LEVEL:-info}">
              <appender-ref ref="STDOUT-ASYNC"/>
          </root>
      </configuration>
      

      With logback 1.3.0 and 1.4.0 this fails with:

      22:49:33,671 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [STDOUT-ASYNC]
      22:49:33,671 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.classic.AsyncAppender]
      22:49:33,673 |-WARN in ch.qos.logback.core.model.processor.AppenderModelHandler - Appender named [STDOUT] not referenced. Skipping further processing.
      22:49:33,673 |-ERROR in ch.qos.logback.classic.AsyncAppender[STDOUT-ASYNC] - No attached appenders found.
      

      To get it to work, I have to switch to the "appender-ref" style.

      <configuration>
          <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
              <encoder class="com.zendesk.logging.JsonLogEncoder"/>
          </appender>
      
          <appender name="STDOUT-ASYNC" class="ch.qos.logback.classic.AsyncAppender">
              <appender-ref ref="STDOUT" />
          </appender>
      
          <root level="${ROOT_LOG_LEVEL:-info}">
              <appender-ref ref="STDOUT-ASYNC"/>
          </root>
      </configuration>
      

      Not sure if this an intentional change to drop support for the format we used earlier, or a bug.

      Thanks

       

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            lukes Luke Stephenson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: