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.
Chad LaVigne

Yahoo! Music Unlimited - Access over 1 million songs. Try it free.