logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Parrish, Ken" <KParr...@gomez.com>
Subject RE: Making SMTPAppender Send Exactly One Email
Date Tue, 10 Jul 2007 13:03:06 GMT
I believe you can 'more or less' get the behavior that you want by
adjusting the buffersize parameter for the SmtpAppender.  This controls
how many log messages are 'ganged up' into a single e-mail.

I often set this parameter to 0 or 1 in circumstances where I want the
e-mail to be sent immediately after logging a single message (a fatal
error requiring immediate action, for example).

I've not done it, but you might try setting the buffersize to a very
large number, then it won't get sent out until that buffersize is hit,
or at the end of your program.  Haven't tried it, but might be worth and
experiment.

Ken Parrish
Gomez, Inc.
Bedford, MA

-----Original Message-----
From: Sanders, Brian [mailto:BSanders@connextions.com] 
Sent: Tuesday, July 10, 2007 7:27 AM
To: Log4NET User
Subject: RE: Making SMTPAppender Send Exactly One Email

You could create a flag and initialize it to false. Then, if an error
occurs, set it to true and check it at the end of the run. If it's true,
then email the log file.

Brian Sanders
Connextions Application Support
407-926-2411 x468

-----Original Message-----
From: koala993 [mailto:koala993@gmail.com] 
Sent: Tuesday, July 10, 2007 5:16 AM
To: log4net-user@logging.apache.org
Subject: Re: Making SMTPAppender Send Exactly One Email


I don't think it's possible, a solution would be to be able to fire only
once
the "ERROR" log in this situation.


Marvin-18 wrote:
> 
> Hi,
> 
> I've read the documentation, but didn't manage to figure out whether
the
> following is possible - and if so, how:
> 
> I have an application that uses Log4Net (d'uh) and I'd like it to send
> me an email with all error messages of one application run.
> The reason is that when for instance the database dies, I'd get LOTS
of
> error messages and I don't want to get thousands of emails about that.
> One email would be more than enough.
> 
> How could I achieve that?
> 
> /Marvin
> 
> 

-- 
View this message in context:
http://www.nabble.com/Making-SMTPAppender-Send-Exactly-One-Email-tf40460
60.html#a11517401
Sent from the Log4net - Users mailing list archive at Nabble.com.


Mime
View raw message