[logback-user] Appender with a triggering level

Ralph Goers rgoers at apache.org
Sun Dec 19 19:03:36 CET 2010

On Dec 17, 2010, at 1:44 PM, Bee-lindgren, Bert A wrote:

> This email is about a method to save detailed log output from failed operations but not from successful operations.
> Our programs try to put all pertinent information in MDC properties or in an error message itself, but sometimes we have found it helpful to have the debug/info message to show what led up to an error. Therefore, we keep debug/info logs when we don't need 99.99% of it; we only need it in the rare occurrence of an error.
> We already have the concept of a thread-specific appender that processes Events for a single thread (fwiw, we use this to capture server-side messages for client requests and then send them back to the client).
> What do people think about this idea:
> 1. An appender with two levels: BaseLevel and TriggerLevel
>   (this would probably be a subclass of AppenderBase and call super(layout, BaseLevel)
> 2. Appender's append() method stores (List, CircularBuffer, etc) ILoggingEvents >= BaseLevel
> 3. If an event happens >=TriggerLevel, Appender prints all stored events as well as all future events

Using log levels for what you are proposing will lead to problems. Instead, I'd suggest just generating an event that contains a Trigger Marker.  Then when the trigger occurs you can publish the previous events.


More information about the Logback-user mailing list