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 "Bulbuk, Ole" <ob...@kelman.de> on 2001/02/12 14:14:07 UTC

Bug in CyclicBuffer.resize(int)?

Hi to all,

I just extended log4j for my needs (my version supports more intelligent
throwables (i.e.: linked throwables, wrapper exceptions, ...) and I added a
simple priority filter for a given priority and up plus I added a buffer
appender) and it worked just great.
The buffer appender stores events in a CyclicBuffer and forwards them all
when a higher event triggers it. This way you get all the warnings, infos
and debug events only when an error occured.
The buffer appender uses the class CyclicBuffer to store the events. But in
the resize(int) method CyclicBuffer doesn't adjust "last".
I suppose there should be something like
if (loogLen == newSize) {
    last = 0;
} else {
    last = loopLen;
}
near the end of the method.
This ensures that last points behind the last event in the array.

Regards,

Ole

P.S.: If anyone is interested in the changes, just send a mail.
-- 
Ole Bulbuk             Fon://+49/30/6576/3724
Kelman GmbH            Fax://+49/30/6576/3601
Haus 40                mailto:OBulbuk@Kelman.de
Koepenicker Str. 325   http://www.Kelman.de
12555 Berlin, Germany

Re: Bug in CyclicBuffer.resize(int)?

Posted by Ceki Gülcü <cg...@qos.ch>.
Ole,

Thanks for the bug report. The fixed version should be in our CVS rep in a few moments. Ceki

At 14:14 12.02.2001 +0100, you wrote:
>Hi to all,
>
>I just extended log4j for my needs (my version supports more intelligent
>throwables (i.e.: linked throwables, wrapper exceptions, ...) and I added a
>simple priority filter for a given priority and up plus I added a buffer
>appender) and it worked just great.
>The buffer appender stores events in a CyclicBuffer and forwards them all
>when a higher event triggers it. This way you get all the warnings, infos
>and debug events only when an error occured.
>The buffer appender uses the class CyclicBuffer to store the events. But in
>the resize(int) method CyclicBuffer doesn't adjust "last".
>I suppose there should be something like
>if (loogLen == newSize) {
>    last = 0;
>} else {
>    last = loopLen;
>}
>near the end of the method.
>This ensures that last points behind the last event in the array.
>
>Regards,
>
>Ole
>
>P.S.: If anyone is interested in the changes, just send a mail.
>-- 
>Ole Bulbuk             Fon://+49/30/6576/3724
>Kelman GmbH            Fax://+49/30/6576/3601
>Haus 40                mailto:OBulbuk@Kelman.de
>Koepenicker Str. 325   http://www.Kelman.de
>12555 Berlin, Germany
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-dev-help@jakarta.apache.org

----
Ceki Gülcü           e-mail: cgu@qos.ch (preferred)
av. de Rumine 5              ceki_gulcu@yahoo.com
CH-1005 Lausanne          
Switzerland            Tel: ++41 21 351 23 15