[logback-user] SMTPAppender capturing disabled logging

ceki ceki at qos.ch
Mon Mar 18 20:52:41 CET 2013


Hi Chris,

The config line

   <logger name="com.a.b.c.IgnoreMe" level="OFF" additivity="false" />

sets the com.a.b.c.IgnoreMe logger's level to OFF will make sure that no 
logs are generated by said logger. You don't need to set additivity to 
false unless com.a.b.c.IgnoreMe has child loggers.

So it's impossible for SMTPAppender to receive logging events generated 
by "com.a.b.c.IgnoreMe" logger.

To control which events trigger email transmission you can set a custom 
evaluator. See
http://logback.qos.ch/manual/appenders.html#smtpAppender_Evaluator
for more details.

HTH,

On 18.03.2013 15:33, Chris Cheshire wrote:
> This is my (relevant) config structure
> <configuration>
>
>    <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
>       ...
>    </appender>
>
>    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
>       ...
>    </appender>
>
>    <root level="ERROR">
>      <appender-ref ref="EMAIL" />
>      <appender-ref ref="FILE" />
>    </root>
>
>    <logger name="com.a" level="INFO" />
>    <logger name="com.a.b.c.IgnoreMe" level="OFF" additivity="false" />
> </configuration>
>
> I have an SMTPAppender emailing me all errors generated by my webapp.
> One specific class is generating false positives so I want to turn
> them off. This has IgnoreMe not logging errors to "FILE", but errors
> are still making it to "EMAIL".
>
> How do I stop them going to the SMTPAppender too?
>
> Note : I have more loggers configured for external libraries set to
> INFO. I'd like to avoid putting appender references in every logger if
> possible.
>
>
> Thanks
>
> Chris


-- 
Ceki
65% of statistics are made up on the spot


More information about the Logback-user mailing list