Do you want the TextBox containing the log file to be updated in real-time as the application is running? Morten Andersen wrote an IAppender that does that:
http://tinyurl.com/rwc4o http://www.mail-archive.com/[email protected]/msg03176.html If you want to show the N most recent entries in a popup window and not have the data update in real time you could extend/modify the MemoryAppender to internally use a CyclicBuffer to store the last N items and automatically discard old entries. Your application would ask for this appender instance from the repository then call GetEvents() to get an array of LoggingEvent objects. Apparently log4net doesn't have a combination BufferingAppender/MemoryAppender appender that buffers the last N events to memory (BufferingAppender is abstract): // ??? public class CyclicMemoryAppender : BufferingAppenderSkeleton { override protected void SendBuffer(LoggingEvent[] events) { // empty } override public void ActivateOptions() { Lossy = true; } virtual public LoggingEvent[] GetEvents() { // ??? return Buffer.Snapshot(); } } Now I'm getting way off topic here...shouldn't CyclicBuffer have a method similiar to PopAll() but without the call to Clear()? Wouldn't that be useful if you wanted to see a snapshot of the items in the buffer without clearing the buffer? --- Saurabh Dani <[EMAIL PROTECTED]> wrote: > Greetings, > > I am writing the logs to log files using File appenders (2 different > logs, one for info and one for debug). > > Is it possible to access these logs and show them within my > application's Interface upon clicking a "view current logs" button? > > Basically I would like to simulate "tail -f" from within the > application. > > Thanks > Saurabh >
