You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "geek.shrek" <mi...@yahoo.com> on 2008/10/09 07:01:17 UTC

How to trigger email eventough there is no ERROR

Hi,

I would like to send email on WARNING level or higher and append it in the buffer. When I reach the end of my application I would like to send email that collected in the buffer even though there is no ERROR.
Is it possible to trigger sending email even though there is no ERROR?

I've tried with the "TriggeringEventEvaluator" but it doesn't seem to work
I set the threshold level to WARN, but to send an email I still need "ERROR" level to trigger sending an email.

Can anyone help me with this?

Thanks,


      

Re: How to trigger email eventough there is no ERROR

Posted by Curt Arnold <ca...@apache.org>.
On Oct 9, 2008, at 12:01 AM, geek.shrek wrote:

> Hi,
>
> I would like to send email on WARNING level or higher and append it  
> in the buffer. When I reach the end of my application I would like  
> to send email that collected in the buffer even though there is no  
> ERROR.
> Is it possible to trigger sending email even though there is no ERROR?
>
> I've tried with the "TriggeringEventEvaluator" but it doesn't seem  
> to work
> I set the threshold level to WARN, but to send an email I still need  
> "ERROR" level to trigger sending an email.
>
> Can anyone help me with this?
>
> Thanks,
>
>

Could you provide your configuration file and version of log4j that is  
being used?  If you turn on log4j debugging (see below), do you get  
any diagnostic messages that might provide any insight.

To turn on internal debugging to console, set log4j.debug=true either  
using the -D command line switch or including in log4j.properties or  
add a debug="true" attribute to the log4j:configuration element in  
log4j.xml.

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


Re: How to trigger email eventough there is no ERROR

Posted by Curt Arnold <ca...@apache.org>.
On Oct 9, 2008, at 12:01 AM, geek.shrek wrote:

> Hi,
>
> I would like to send email on WARNING level or higher and append it  
> in the buffer. When I reach the end of my application I would like  
> to send email that collected in the buffer even though there is no  
> ERROR.
> Is it possible to trigger sending email even though there is no ERROR?
>
> I've tried with the "TriggeringEventEvaluator" but it doesn't seem  
> to work
> I set the threshold level to WARN, but to send an email I still need  
> "ERROR" level to trigger sending an email.
>
> Can anyone help me with this?
>
> Thanks,
>
>

I've just committed a change that adds a sendOnClose property to  
SMTPAppender.  Please try it and see if it addresses your desire to  
have all pending logging events send on application shutdown.  It may  
or may not be necessary to call LogManager.shutdown() to shutdown  
log4j at the end of the application life to result in  
SMTPAppender.close() to be called. 

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