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

Add discardWhenFull config option to AsyncAppender

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • None
    • 1.1.11
    • logback-classic
    • None

    Description

      The current AsyncAppender implementation blocks once the queue is full. In some situations the user would rather lose log messages than block on the log call. It would be very helpful to make this configurable.

      My current workaround is to create a class that extends AsyncAppenderBase and overrides the append() method and calls blockingQueue.offer() instead of put().

      Suggested solution:

      1. Add a configurable attribute such as discardWhenFull that defaults to false
      2. In AsyncAppenderBase.append() use blockingQueue.offer() if discardWhenFull is true
      3. Add some method of tracking how many events were dropped; a simple counter with public accessor should suffice

      Attachments

        Activity

          People

            logback-dev Logback dev list
            srwilson Scott Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: