Mathew,

you need to extend TriggeringEventEvaluator with your priority
and then pass it to SMTPAppender constructor.

class DebugEvaluator implements TriggeringEventEvaluator {
  /**
     Lowest priority will trigger e-mail. It is up to mailFilter
        to filter on Priority to control the amount of emails being
generated. 
        Ideally, lowest triggering priority should be ERROR.

     <p>This method returns <code>true</code>, if the event priority
     has DEBUG priority or higher. Otherwise it returns
     <code>false</code>. */
  public 
  boolean isTriggeringEvent(LoggingEvent event) {
    return event.priority.isGreaterOrEqual(Priority.DEBUG); 
  }
}

TriggeringEventEvaluator eval = new DebugEvaluator();
SMTPAppender smtpApp = new SMTPAppender(eval); 

This works fine for me.

Michael

> -----Original Message-----
> From: Mathew, Bindhu [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 25, 2001 12:20 PM
> To: '[EMAIL PROTECTED]'
> Subject: SMTPAppender - again
> 
> 
> 
>  
> Hi,
> 
>    In our project I am sending log messages via e-mail using 
> SMTPAppender.I
> override the method 'isTriggeringEvevt() 'in the interface
> TriggeringEventEvaluator like
> public boolean isTriggeringEvent(LoggingEvent event)
>     {
>         if (event == null) {
>             return false;
>         }
>         else {
>             return event.priority.isGreaterOrEqual(Priority.WARN);
>         }
> 
>     }
> Still my Logger is sending a mail only if the priority is 
> ERROR or FATAL? 
>  
> Where am I wrong? any help is appreciated.
> thanx,
> bmathew.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to