Curt thanks for the response. I understand that the INFO and lesser level logs 
are maintained in a
buffer till and ERROR event occurs (maybe for efficiency?). There might be 
valid scenarios when the users might want to receive the mail as soon as the 
INFO event occurs and not wait till some ERROR event is logged (which in some 
applications might never be logged). Currently, in such cases where the user 
needs to override this behaviour, he needs to provide his own implementation  
for the TriggeringEventEvaluator, which does not  seem reasonable.  An 
alternate approach would be to allow the user to configure the "TriggerLevel" 
in the configuration file instead of hardcoding this to ERROR in the 
DefaultEvaluator. This would ensure that the user has the flexibility to 
configure this.

>> I don't have time to review it at the moment, but will get back to  you 
>> later.

Sure, no problem. Let me know whenever you get some spare time.

-Jaikiran


----- Original Message ----
From: Curt Arnold <[EMAIL PROTECTED]>
To: Log4J Users List <[email protected]>
Sent: Thursday, 5 July, 2007 1:52:00 AM
Subject: Re: SMTPAppender ignores Threshold value


On Jul 4, 2007, at 1:28 PM, jaikiran pai wrote:

> Recently i saw a post on one of the forums where a user complained  
> that the SMTPAppender does not take into account the Threshold  
> value that is specified in the configuration. By default, the  
> appender logs only events which have a level eqaul to or higher  
> than ERROR. Here's  one post in this mailing list which proves the  
> same:
>
> http://www.mail-archive.com/[EMAIL PROTECTED]/ 
> msg03741.html
>
> This appears to be because of the DefaultEvaluator inside the  
> SMTPAppender which has the following logic:
>
> class DefaultEvaluator implements TriggeringEventEvaluator {
>
>   /**
>      Is this <code>event</code> the e-mail triggering event?
>
>      <p>This method returns <code>true</code>, if the event level
>      has ERROR level or higher. Otherwise it returns
>      <code>false</code>. */
>   public
>   boolean isTriggeringEvent(LoggingEvent event) {
>
>     return event.getLevel().isGreaterOrEqual(Level.ERROR);
>   }
>
>
> Users who want to log messages with levels lesser than ERROR,  
> currently have to configure their *own implementation* of the  
> TriggeringEventEvaluator. This doesnt seem right. I would prefer  
> the DefaultEvaluator  take into account the Threshold value that  
> has been specified in the log4j configuration file
>  instead of hardcoding the Level.ERROR. After all, that's what the  
> Threshold attribute is meant to do.
>
> The fix (if i can call it so) appears simple - just have to pass on  
> the Threshold value from the appender to the DefaultEvaluator. Let  
> me know if anyone wants me to send a patch for this.
>
> regards,
> -Jaikiran


The threshold and trigger are two different things.  The threshold  
determines what events go into the mail message, the trigger  
determines when the message is sent.  If you set threshold to INFO  
and trigger to ERROR, when there is an ERROR you will get an email  
with all INFO and high level messages since the last error.

I don't have time to review it at the moment, but will get back to  
you later.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download 
Now! http://messenger.yahoo.com/download.php

Reply via email to