[logback-user] error log : one email per request

Ceki Gulcu ceki at qos.ch
Fri Mar 25 13:41:38 UTC 2016


To recapipulate, ThresholdFilter filters out all events other than 
ERROR. Thus, it is expected that the outgoing emails contain only errors.

Here is your original specification:

* All the messages logged during one request handling are grouped into
one email, and the email is sent only when error occurs (i.e. at least 
one of log events is at level ERROR)

This specification can be fulfilled by removing or at least altering the 
ThresholdFilter in your configuration file.


On 3/24/2016 14:51, Weipeng He wrote:
> Yes. The filter is what I intended to use.
> However, when there are two ERROR events during one request, there will
> be two emails.
>
> best,
> Weipeng
>
> On 03/24/2016 09:45 PM, Ceki Gulcu wrote:
>> Your config file contains the following declaration:
>>
>>     <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
>>       <level>ERROR</level>
>>     </filter>
>>
>> Thus, all events of level WARN, INFO, DEBUG and TRACE are filtered
>> out. SMTPAppender does not get a chance to see them.
>>
>> --
>> Ceki
>>
>> On 3/24/2016 14:24, Weipeng He wrote:
>>> enclosed is the logback.xml file. I add those mdc values in a filter.
>>> Thanks.
>>>
>>> Best,
>>> Weipeng
>>>
>>> On 03/24/2016 08:57 PM, Ceki Gulcu wrote:
>>>>
>>>> Comments inline.
>>>>
>>>> On 3/24/2016 13:31, Weipeng He wrote:
>>>>> Hi all,
>>>>>
>>>>> I am using SMTPAppender for error report in a web application. Using
>>>>> default setting, the logger sends one email per log message.
>>>>> However, I
>>>>> was trying make it like this :
>>>>>
>>>>> * All the messages logged during one request handling are grouped into
>>>>> one email, and the email is sent only when error occurs (i.e. at least
>>>>> one of log events is at level ERROR)
>>>>
>>>> This is the default behavior. Can you post your logback.xml file?
>>>>
>>>>> Is there any easy way to implement this?
>>>>>
>>>>> Thank you.
>>>>>
>>>>> Best,
>>>>> Weipeng
>>>>> _______________________________________________
>>>>> logback-user mailing list
>>>>> logback-user at qos.ch
>>>>> http://mailman.qos.ch/mailman/listinfo/logback-user
>>>> _______________________________________________
>>>> logback-user mailing list
>>>> logback-user at qos.ch
>>>> http://mailman.qos.ch/mailman/listinfo/logback-user
>>>
>>>
>>>
>>> _______________________________________________
>>> logback-user mailing list
>>> logback-user at qos.ch
>>> http://mailman.qos.ch/mailman/listinfo/logback-user
>>>
>> _______________________________________________
>> logback-user mailing list
>> logback-user at qos.ch
>> http://mailman.qos.ch/mailman/listinfo/logback-user
>
> _______________________________________________
> 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