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

Recording appender that dumps debug messages only when error occurs

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.9.28
    • Fix Version/s: None
    • Component/s: logback-classic
    • Labels:
      None

      Description

      Provide built-in utility appender that silently stores last few logging messages and dumps them (forwards to a target appender) only when an error occurs. Older logging events are replaced with new ones. This is a configuration example:

      <configuration>
      <appender name="REC" class="ch.qos.logback.classic.RecordingAppender">
      <appender-ref ref="STDOUT"/>

      <maxEvents>1000</maxEvents>
      <dumpThreshold>WARN</dumpThreshold>
      <expiryTimeMs>15000</expiryTimeMs>
      </appender>

      <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
      <encoder>
      <pattern>%-4relative [%thread] %-5level - %msg%n</pattern>
      </encoder>
      </appender>

      <root level="DEBUG">
      <appender-ref ref="REC"/>
      </root>
      </configuration>

      Such an appender is crafted manually by several users, it would be nice to provide it out of the box. I already implemented this feature (100% test coverage):

      https://github.com/nurkiewicz/logback/tree/recording-appender

        Attachments

          Activity

            People

            • Assignee:
              logback-dev Logback dev list
              Reporter:
              nurkiewicz Tomasz Nurkiewicz
            • Votes:
              6 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated: