You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Ole Bulbuk <Ol...@ebp.de> on 2002/09/26 16:16:49 UTC
BufferAppender and CyclicBuffer
Hi,
I have just downloaded Log4J 1.2.6 and have made a simple BufferAppender.
This is storing log events in a cyclic buffer and overwrites the oldest log
event when a new one is appended. The whole buffer and the new message are
forwarded to a subappender if the new log event has got a priority that is
high enough.
This means one won't get all the debug and info messages in the log (so the
log would keep small and clean) unless a log event with a priority that is
high enough (e.g. ERROR) occurs. Then the log will contain not only the
error itself but its history too.
The class has got only one small error:
If the size is decreased while the buffer is full the oldest messages remain
in the buffer instead of the newest ones. This is because
helper.CyclicBuffer is used internally.
I would be willing to change this if nobody objects. What is CyclicBuffer
used else for?
I would donate the BufferAppender to the project if you are interested.
Regards,
Ole
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>