From: Kevin G. <ke...@go...> - 2003-01-31 17:13:50
|
msc...@ao... wrote: > In a message dated 1/31/2003 1:58:03 AM Eastern Standard Time, > "Dintelmann, Peter" <Pet...@Dr...> writes: > >> I am looking for a feature similar to syslog's "last message >> repeated N times" in Log4perl. The intended use is for database >> connection modules and the like. > > Sounds like a very useful feature to me. However, I haven't seen it > anywhere in log4j's implementation, have you? > > Some random thoughts: > > The easiest way to implement it would probably be to have an appender > taking care of buffering (similar to what Log::Dispatch::Email does > now) and employing some logic to decide when to log (somewhat tricky, > because you can't buffer forever and if you don't flush before the > program ends, the messages are lost). My thoughts exactly, shouldn't be too hard for you to do. If you need a hint how to get started, you subclass Log::Dispatch::Output providing your own log_message() method, then reference your new subclass in the config like this: log4j.appender.appndr1 = My::Buffered::Appender log4j.appender.appndr1.layout = Log::Log4perl::Layout...whatever ...etc. -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |