logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giovanni Cuccu - CUP2000 <giovanni.cu...@cup2000.it>
Subject Re: Is it possible to e-mail all logging related to a specific thread?
Date Wed, 30 Aug 2006 16:12:16 GMT
I send mail using a custom class. my code looks like:
try {
.....
}catch (Exception e) {
	String content=....//create mail body basing on contxt info and exception
	Mailer.sendMail(content);
}
sendMail spawns a thread in order to do an async send.
I looked at SMTP appender and it seems that it works accumulating 
messages in a buffer and then sending the email if a class implementing 
TriggeringEventEvaluator returns true. If so this a very good point to 
start since I can reuse the buffer (changing its recycling buffer) and 
the trigger logic.
Thanks a lot,
	Giovanni

> How do you send emails right now?  I can't think of a way to do this
> without writing an appender.  I think the SMTPAppender send some of
> the logs before the error but probably not exactly what you want.
> 
> On 8/30/06, Giovanni Cuccu - CUP2000 <giovanni.cuccu@cup2000.it> wrote:
>> I do not use an email appender, but a java method.If I correctly
>> understand your proposal I have to write a custom appender anyway ,i.e.
>> standard log4j distribution does not provide a solution for my problem,
>> is it right?
>> Giovanni Cuccu
>> > You could maybe make an appender that adds the event to the MDC and
>> > then have your email appender include the MDC.  Be sure to clear the
>> > MDC at the end of the request.  That seems like it might be the
>> > easiest solution but someone else might have a better idea.
>> >
>>
>> -- 
>> Giovanni Cuccu
>> CUP 2000 Spa
>> Via del Borgo di S. Pietro, 90/c - 40126 Bologna
>> e-mail: giovanni.cuccu _at_ cup2000.it
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
> 
> 


-- 
Giovanni Cuccu
CUP 2000 Spa
Via del Borgo di S. Pietro, 90/c - 40126 Bologna
e-mail: giovanni.cuccu _at_ cup2000.it


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message