logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <remko.po...@gmail.com>
Subject Re: [log4j 1.x] Batch-sending with SMTPAppender
Date Wed, 16 Nov 2016 23:36:24 GMT

Are you aware that there is a log4j-1.2-api adapter included in Log4j2 that allows you to
keep your application code unchanged (unless you rely on the innards of Log4j 1.2)?

You only need to change the configuration (the manual has tons of examples). 

Just FYI. 

Sent from my iPhone

> On 17 Nov 2016, at 7:33, Christopher Schultz <chris@christopherschultz.net> wrote:
> 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

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message