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

appenderRef does not work for reactor.logback.AsyncAppender

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.1.2
    • logback-classic

    Description

      Configuration: logback.groovy
      import ch.qos.logback.classic.encoder.PatternLayoutEncoder
      import ch.qos.logback.core.ConsoleAppender
      import ch.qos.logback.core.rolling.RollingFileAppender
      import ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP
      import ch.qos.logback.core.rolling.TimeBasedRollingPolicy
      import reactor.logback.AsyncAppender
      
      import static ch.qos.logback.classic.Level.DEBUG
      import static ch.qos.logback.classic.Level.INFO
      
      appender("fileAppender", RollingFileAppender) {
          file = "/var/log/tomcat/project.log"
          rollingPolicy(TimeBasedRollingPolicy) {
              fileNamePattern = "/var/log/tomcat/project-%d{yyyy-MM-dd}.%i.log"
              timeBasedFileNamingAndTriggeringPolicy(SizeAndTimeBasedFNATP) {
                  maxFileSize = "50MB"
              }
          }
          encoder(PatternLayoutEncoder) {
              pattern = "%gray(%d{yyyy-MM-dd}) %cyan(%d{HH:mm:ss}).%yellow(%d{SSS}) %highlight(%-5level) %green(%logger{36}) - %msg%n"
          }
      }
      
      appender("async", AsyncAppender) {
          appenderRef('fileAppender')
      }
      
      root(INFO, ["async"])
      
      

      Logs are printed in tomcat server log instead of specified files and also contain error from logback:

      log
      INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.groovy] at [file:/path/to/project/WEB-INF/classes/logback.groovy]
      INFO in ch.qos.logback.classic.gaffer.ConfigurationDelegate@79ace34b - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
      INFO in ch.qos.logback.classic.gaffer.ConfigurationDelegate@79ace34b - Naming appender as [fileAppender]
      INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - No compression will be used
      INFO in c.q.l.core.rolling.TimeBasedRollingPolicy - Will use the pattern /var/log/tomcat/project-%d{yyyy-MM-dd}.%i.log for the active file
      INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@75b6be5b - The date pattern is 'yyyy-MM-dd' from file name pattern '/var/log/tomcat/project-%d{yyyy-MM-dd}.%i.log'.
      INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@75b6be5b - Roll-over at midnight.
      INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@75b6be5b - Setting initial period to Mon Aug 11 10:21:39 UTC 2014
      INFO in ch.qos.logback.core.rolling.RollingFileAppender[fileAppender] - Active log file name: /var/log/tomcat/project.log
      INFO in ch.qos.logback.core.rolling.RollingFileAppender[fileAppender] - File property is set to [/var/log/tomcat/project.log]
      INFO in ch.qos.logback.classic.gaffer.ConfigurationDelegate@79ace34b - About to instantiate appender of type [reactor.logback.AsyncAppender]
      INFO in ch.qos.logback.classic.gaffer.ConfigurationDelegate@79ace34b - Naming appender as [async]
      
      ERROR in ch.qos.logback.classic.gaffer.AppenderDelegate@605215a4 - Appender [async] of type [reactor.logback.AsyncAppender] has no appplicable [appenderRef] property 
      
      INFO in ch.qos.logback.classic.gaffer.ConfigurationDelegate@79ace34b - Setting level of logger [ROOT] to INFO
      INFO in ch.qos.logback.classic.gaffer.ConfigurationDelegate@79ace34b - Attaching appender named [async] to Logger[ROOT]
      

      Attachments

        Activity

          People

            logback-dev Logback dev list
            czar Alexander Czar
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: