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



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

Reply via email to