[logback-user] SMTPAppender with multiple evaluators

Ceki Gülcü ceki at qos.ch
Tue Apr 6 23:33:56 CEST 2010


Hello Naor,

It seems to me that a single evaluator could almost do the job:

- if exception type for the current event is A0 or A1 and counter == 0
then return true (trigger outgoing email), increment the counter, set
next = now+1hour

- if exception type for the current event is A0 or A1 and counter !=
0, and next < now, return true (trigger outgoing email), set next =
now+1hour

- if exception type other than A0 or A1, return true

- otherwise return false

Evaluators can only act as an email trigger, they can't influence the
contents of the outgoing email. The point is that an evaluator is free
to use any logical criteria to whether to trigger outgoing email or
not.

HTH

On 06/04/2010 7:34 PM, Naor Yuval wrote:
> Hi.
>
> I am looking to implement an SmtpAppender that will allow to specify
> “delivery rules” based on the evaluation of the error-log.
>
> For example, for some specific exceptions we wish to send the first
> occurrence, then buffer the rest and send a digest every hour.
>
> For other specific exception types we wish to send each log immediately
>
> What is the recommended way to implement such behavior? Could appenders
> be chained somehow to accomplish this?
>
> Thanks,
>
> Naor


More information about the Logback-user mailing list