logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Hudak <CHu...@arrowheadgrp.com>
Subject RE: can I use email and message buffer as appenders?
Date Wed, 10 Oct 2001 16:12:12 GMT

>I'm new to log4j, so forgive me if this is a stupid question, but how can I
>use email as an appender? Also can I use an in-memory buffer as an
>appender, and then retrieve the contents of that buffer at a later stage?

You can actually use a regular WriterAppender via something like this:

Layout layout = new PatternLayout("%m%n");
OutputStream os = new ByteArrayOutputStream(8192); // 8K buffer
WriterAppender buffer = new WriterAppender(layout, os);

When you are 'done' logging, you can dump the buffer to an email application
or do a screen dump:


I like the idea of subclassing the WriterAppender to have it manage the
buffer especially if it needs to be resized but this will work in a pinch.



To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org

View raw message