I can certainly do that. For my needs the SMTPAppender was more severely hacked (SSL, http tunneling and JMS options) but the delay mod can easily fit into a TriggeringEventEvaluator. Any suggestions for a name?


ErrorDelayEvaluator
DelayedEvaluator
DelayMultipleEventsEvaluator
DelaySubsequentEventsEvaluator
DelayAfterTriggerEventEvaluator


The algorithm would work as follows (Some obvious blanks to fill in). Note that the first event after the delay will trigger true if any trigger events happened during the delay.


public class DelayedEvaluator implements TriggeringEventEvaluator {

  private TriggeringEventEvaluator delegateEvalutor_;
  private Long delayUntil_;
  private boolean triggersDuringDelay_ = false;
  private TimeDuration delay_ = new TimeDuration( "5 minutes" );

  public boolean isTriggeringEvent(LoggingEvent event);

if ( delayUntil_ == null ) {
if ( delegateEvalutor.isTriggeringEvent( event ) ) {
delayUntil_ = new Long( delay_.inMilliseconds() + event.getStartTime() );
triggersDuringDelay_ = false;
return true;
}
} else if ( event.getStartTime() > delayUntil_.longValue() ) {
delayUntil_ = null;
boolean returnMe = triggersDuringDelay_;
triggersDuringDelay_ = false;
return returnMe;
} else {
if ( !triggersDuringDelay && delegateEvalutor_.isTriggeringEvent( event ) ) {
triggersDuringDelay_ = true;
}
return false;
}
}
}


My only question with this is in 1.3 would you be able to instantiate an evaluator chain via config files. I.e. in 1.2 I think you owuld only be able to do this programmattically.





Scott Deboy wrote:
I'd suggest not contributing a new SMTPAppender, but contributing an 
implementation of TriggeringEventEvaluator that meets your 'don't send for 5 
minutes' policy.

Scott


-----Original Message----- From: Mark Womack [mailto:[EMAIL PROTECTED] Sent: Thu 5/5/2005 10:25 AM To: 'Log4J Developers List' Cc: Subject: RE: contribs and how does it work Glen,

Thanks for the interest and email.  Contributions to the contribs directory
can be very straight forward since it does not really require any changes in
the core code.  Just submit the source files with the Apache license
embedded at the top (you have to have permission to contribute them under
that license).  Better yet, contribute the entire directory as a zip file
(source files, readme, contact info, etc), attach it to a Bugzilla bug for
log4j, and one of us will make sure it gets in at some point in the near
future.

You can go farther if you want, by contributing changes to the core code
that has your changes, etc.  Submitting that with clear description,
patches, test cases, etc will certainly help them to be accepted, but that
is not guaranteed.  We would review them and decide if appropriate, etc.
since it something the committers will be supporting long term.  Do that
enough times and you may find yourself a log4j committer.  :-)

-Mark


-----Original Message-----
From: Glen [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 05, 2005 9:37 AM
To: [email protected]
Subject: contribs and how does it work

Hi All,
I have developped two appenders that I would like to know if the log4j
team is interested in.  Perhaps worthy of being in the contribs folder
for log4j.  I am not sure of the process but I will simply explain the
appenders and go from there.

- HouseKeepingFileAppender:  logs to a file that rolls over daily (no
big woop).  The key bit is that it will move all old/rolled logs to an
archive folder (and optionally compress them) and will also remove all
log files in the archive folder older than x days (default is 30)

- SMTPAppender:  basically a duplicate of the smtp appender with the
caveat that once it emails an error it will wait a set time before
sending another error (default 5 minutes).  This was because as we all
know when things blowup they can blowup a whole lot so it has saved me
from having an inbox with 400 emails on a few occasions.


These have been tested in and developed for 100 photo kiosks operating 7x24...


cheers, Glen








--------------------------------------------------------------------- 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]






--------------------------------------------------------------------- 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