[logback-user] SMTPAppender capturing disabled logging

Chris Cheshire cheshirator at gmail.com
Mon Mar 18 21:05:26 CET 2013


OK I looked at it some more and I found an error in the declaration
for the logger in my Java.

The logger is in an abstract class that IgnoreMe and a lot of others
extend. I had it reference the base class name directly instead of
using getClass(). This should fix the snafu.

Thanks :)



On Mon, Mar 18, 2013 at 3:52 PM, ceki <ceki at qos.ch> wrote:
> 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
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user


More information about the Logback-user mailing list