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, 16 Nov 2016 22:33:36 GMT
Scott,

On 11/16/16 2:09 PM, Scott Harrington wrote:
>>> On 11/16/16 9:49 AM, Ralph Goers wrote:
>>>> First, I have to say that Log4j 1 reached end-of-life over a year
>>>> ago. We recommend you upgrade to Log4j 2.
>>>
>>> Fair enough. I'm not quite there, yet. I suspect that log4j 2 will have
>>> the same issue, though.
>>
>> I don’t know how to configure a TriggeringEventEvaluator in Log4j 1
>> but I’d bet google does ;-)
> 
> Chris: I have a ThrottledSMTPApppender subclass that I used for years
> under Log4j 1.x, it's very small but was somewhat tricky; it starts a
> "flusher" thread and attaches a shutdown hook to drain before exit.
> There is a TriggeringEventEvaluator that always returns false. There is
> a configureable "initialDelay" (default 10 seconds) and
> "messageInterval" (default 60 seconds).

That sounds cool, but maybe overkill if I can get the
TriggeringEventEvaluator working with the stock log4j distro.

(It looks like I'll need to write my own NeverTriggerEventEvaluator to
do that. It looks trivial so I'll try that first.)

> I've since moved up to Log4j 2, and you are correct that Log4j 2 didn't
> do throttling/batching quite like I wanted, so I have a "ThrottledSMTP"
> Plugin for Log4j 2.

:)

> There was some discussion of this at LOG4J2-252, which is still open.
> I'll attach my two variants to that ticket with the hope they may be
> useful as-is to you or to others. However I don't have the time in
> foreseeable future to prepare the proper unit test and documentation
> that would be required to make it part of official Log4j2.

Understood. If I (a) go down the ThrottledSMTPAppender route and (b)
move to log4j 2, I may finish-off that work. It's a long-shot, though.

I really appreciate the feedback, though.

-chris


Mime
View raw message