logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: [log4j 1.x] Batch-sending with SMTPAppender
Date Wed, 30 Nov 2016 16:41:08 GMT
All,

On 11/17/16 10:28 AM, Christopher Schultz wrote:
>> So, I implemented an event trigger class in my driver class like this:
>>
>> package com.my;
>> public class Driver
>> {
>>     [...]
>>     public static class NeverTriggeringEventEvaluator
>>         implements TriggeringEventEvaluator
>>     {
>>         @Override
>>         public boolean isTriggeringEvent(LoggingEvent arg0) {
>>             return false;
>>         }
>>     }
>> }
>>
>> I enabled it in my configuration file like this:
>>
>> log4j.appender.CLIENT.evaluatorClass=com.my.Driver$NeverTriggeringEventEvaluator

When using this NeverTriggeringEventEvaluator, I'm getting the behavior
I want: all of my error messages are being sent in a single email message.

Thanks to all involved.

I may update it to be sensitive to the number of logging events so that
it never actually loses events. Right now, I believe if I hit 501
events, I'll lose one in the message that is sent when the appender is
shut-down.

-chris


Mime
View raw message