You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Marvin <lo...@groenndemon.de> on 2007/07/08 23:37:02 UTC

Making SMTPAppender Send Exactly One Email

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

Unsubscribing

Posted by Ian Dykes <ia...@esendex.com>.
To people trying to unsubscribe:
http://logging.apache.org/log4net/support.html

"To unsubscribe from this list send an e-mail to
log4net-user-unsubscribe@logging.apache.org." 

Ian Dykes 
Software Developer 
Esendex Ltd 

T: +44 (0)115 852 5762 
F: +44 (0)115 852 5757 
Email: ian.dykes@esendex.com 
Web: www.esendex.com 
Blog: http://devproj20.blogspot.com/ 

Earn up to ?100 in high street vouchers, refer a friend or colleague today. https://www.esendex.com/uk/recommend/recommend.aspx
 
Confidentiality: This e-mail (and any associated files) is intended only for the use of log4net-user@logging.apache.org and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not log4net-user@logging.apache.org you are hereby notified that any disclosure, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and then delete it from your computer. Messages sent to and from us may be monitored. The views expressed in this message are those of the author Ian Dykes and do not necessarily represent the views of Esendex Ltd.
 
Security: This e-mail and any attachments are believed to be free from any virus but it is the responsibility of the recipient to ensure this is so. E-mail is not a 100% secure communications medium. We recommend you observe this when e-mailing us.
 
Esendex Ltd is a limited company registered in the UK, with company number 04217280 and having its registered office at 32a Stoney Street . Nottingham . NG1 1LL . United Kingdom.
 
[v1.1 EN]

RE: Making SMTPAppender Send Exactly One Email

Posted by Joe Waldner <jw...@amtelco.com>.
Unsubscribe

-----Original Message-----
From: koala993 [mailto:koala993@gmail.com] 
Sent: Wednesday, July 11, 2007 7:51 AM
To: log4net-user@logging.apache.org
Subject: RE: Making SMTPAppender Send Exactly One Email


I don't think this would work either : the bufferSize is actually the
number
of messages that are sent when a fatal log (or error log according to
your
threshold) is fired. This is sort of the context of this log (what
happened
before the error) but not the number of log that you have to wait before
to
receive an email.


Parrish, Ken wrote:
> 
> 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.
> 
> 
> 

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


RE: Making SMTPAppender Send Exactly One Email

Posted by koala993 <ko...@gmail.com>.
I don't think this would work either : the bufferSize is actually the number
of messages that are sent when a fatal log (or error log according to your
threshold) is fired. This is sort of the context of this log (what happened
before the error) but not the number of log that you have to wait before to
receive an email.


Parrish, Ken wrote:
> 
> 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.
> 
> 
> 

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


RE: Making SMTPAppender Send Exactly One Email

Posted by "Parrish, Ken" <KP...@gomez.com>.
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.


RE: Making SMTPAppender Send Exactly One Email

Posted by Joe Waldner <jw...@amtelco.com>.
unsubscribe

-----Original Message-----
From: koala993 [mailto:koala993@gmail.com] 
Sent: Tuesday, July 10, 2007 4: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.


Re: Making SMTPAppender Send Exactly One Email

Posted by Marvin <lo...@groenndemon.de>.
Sanders, Brian wrote:
> 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.

So there's no way to do this with SMTPAppender itself?
Then I'll rather use a FileAppender and send the error log using a
second program.

/Marvin


RE: Making SMTPAppender Send Exactly One Email

Posted by "Sanders, Brian" <BS...@connextions.com>.
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.


Re: Making SMTPAppender Send Exactly One Email

Posted by koala993 <ko...@gmail.com>.
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-tf4046060.html#a11517401
Sent from the Log4net - Users mailing list archive at Nabble.com.