[logback-user] Appender with a triggering level

Ceki Gulcu ceki at qos.ch
Mon Dec 20 10:04:37 CET 2010


On 19.12.2010 19:03, Ralph Goers wrote:
>
> 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.

Yep, using a marker to trigger a particulat action, printing in your 
case, is the recommended approach.

> Ralph

--
Ceki



More information about the Logback-user mailing list