[logback-user] Buffered Appender?
Ceki Gulcu
listid at qos.ch
Fri Aug 15 20:25:50 CEST 2008
Hello Eric,
The logback and log4j share the same basic architecture. In principle, anything
you can do in log4j you can do in logback. Rewriting a log4j appender in logback
should be a 15 minute endeavor.
You can take advantage of logback markers so that you can mark the begging and
an end of a section (however long). If the section end without any errors you
ditch the buffered events. Otherwise, if an error occurs, you log them.
This is very similar to your test function, except that markers give you a way
to indicate the start and the end of buffering.
Cheers,
Eric Faden wrote:
> I want the ability to buffer up the last N messages above some level and
> then release them all if it gets a message above another level. I know
> you can make a custom appender for Log4j for this, but is it possible in
> LogBack. As an example....
>
> I have a class A with a function Test()..... Test has a couple Debug
> messages which I want to get buffered. If Test throws an Error level
> message I want the appender to dump the Debug messages and then the
> Error one.
>
> Is that possible?
>
> -Eric
--
Ceki Gülcü
QOS.ch is looking to hire talented developers located in
Switzerland. Please contact ceki at qos.ch for details.
More information about the Logback-user
mailing list