logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "geek.shrek" <miss_cool_...@yahoo.com>
Subject Re: How to trigger email eventough there is no ERROR
Date Fri, 10 Oct 2008 00:42:15 GMT
Hi,

I'm using log4j 1.2  with java 1.4.2

my log4j.properties
log4j.rootCategory=DEBUG, mail
log4j.rootCategory.debug=true

log4j.appender.mail=org.apache.log4j.net.SMTPAppender
log4j.appender.mail.EvaluatorClass=com.test.myEvaluator
log4j.appender.mail.threshold=WARN
log4j.appender.mail.SMTPHost=myhost.com
log4j.appender.mail.To=test@myhost.com
log4j.appender.mail.From=test@myhost.com
log4j.appender.mail.Subject=Reporting
log4j.appender.mail.layout=org.apache.log4j.PatternLayout
log4j.appender.mail.layout.ConversionPattern=%d %p [%c] - %m %n
log4j.appender.mail.SMTPDebug=true

I also tried to create my own appender which extends SMTPAppender
and overide activateOptions and add  LogManager.getLoggerRepository().setThreshold(Level.WARN);

I still need to have an ERROR to be able to send email.

I'm trying to build the log4j that you just updated in the repository .. Thanks for that :)
, but I'm still struggling to build it with maven since I'm not so familiar with maven. But
it seems like exactly what I need for my application.


Thanks,




----- Original Message ----
From: Curt Arnold <carnold@apache.org>
To: Log4J Users List <log4j-user@logging.apache.org>
Sent: Friday, October 10, 2008 3:07:06 AM
Subject: Re: How to trigger email eventough there is no ERROR


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


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message