logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chad LaVigne <chad_lavi...@yahoo.com>
Subject code contribution
Date Wed, 05 Jul 2006 16:27:06 GMT
Hello Log4j development team,
   
  My name is Chad LaVigne.  I would like to submit a filter I've written for consideration
as an addition to the log4j project.  It is a filter that regulates bursts in logging using
the Token Bucket algorithm.  It is useful in situations where you want to limit the number
of log messages that can be generated in a certain time span.  This is often the case during
a system failure type situation, you don't want to stop logging but you want to limit the
number of messages that get logged to a reasonable amount.  This is how the filter works:
   
  The filter uses a token bucket object that contains a configurable number of tokens, specified
by the filter init parameter maxTokens.  Every time a log statement is sent to an appender
using this filter, the filter removes a token from the bucket. If no tokens are left in the
bucket the log statement is suppressed. Tokens are added back to the bucket at a configurable
rate that is calculated by two init parameters, tokenFillAmount and tokenFillInterval.  The
number of tokens specified by tokenFillAmount are added every tokenFillInterval seconds up
to the maximum number specified by maxTokens.
   
  I've attached the source code, a test class and a log4j configuration file that utilizes
the filter.  Please let me know if you have any questions or comments.
 
Sincerely,
Chad LaVigne

 		
---------------------------------
Yahoo! Music Unlimited - Access over 1 million songs.Try it free. 
Mime
View raw message