[logback-user] SMTPAppender with multiple filters
ceki
ceki at qos.ch
Fri Apr 12 17:30:19 CEST 2013
Filters attached to an appender determine whether the containing
appender sees events. For example, the following configuration snipped
will cause appender A to only see events of level WARN.
<appender name="A" class="...."/>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>WARN</level>
<onMatch>NEUTRAL</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
Note that ch.qos.logback.classic.filter.LevelFilter is an equality
filter checking on Level.WARN. Appender A will never see events of level
TRACE, DEBUG, INFO and ERROR.
Triggering of emails is determined by the evaluator [1] assigned to
SMTPAppender. For an event to trigger a message, it must pass through
all the filters attached to SMTPAppender and have the evaluator return true.
HTH,
[1] http://logback.qos.ch/manual/appenders.html#smtpAppender_Evaluator
On 12.04.2013 16:47, romeara wrote:
> Hi there,
>
> I'm having an issue with using multiple filters as you had outlined in a
> previous post:
>
> <appender name="SQL_TRANSACTION_DELAY_EMAIL"
> class="ch.qos.logback.classic.net.SMTPAppender">
> <filter class="ch.qos.logback.classic.filter.LevelFilter">
> <level>WARN</level>
> <onMatch>NEUTRAL</onMatch>
> <onMismatch>DENY</onMismatch>
> </filter>
> <filter
> class="com.annadaletech.taxfree.kioskapp.util.SQLTransactionDelayFilter">
> <transactionDelayText>running time
> (millis)</transactionDelayText>
> </filter>
> ...
> </appender>
>
> The first filter is looking for any log entry marked as [WARN ] and the
> second checks this message for my own user defined value and whether or not
> the email needs to be sent. However, though the second filter code is being
> accessed, the email is not passed from an ACCEPT filterReply.
>
> I've also read somewhere that apparently the SMTPAppender wont send an email
> unless its catching an ERROR message. If so, how can I alter this?
>
> Your thoughts appreciated,
>
>
> Ray.
>
>
--
Ceki
65% of statistics are made up on the spot
More information about the Logback-user
mailing list