views:

611

answers:

1

I do have db appender and know how to get the output to a custom "logging" page ... The idea is to have a quick and dirty switch to write for example to the Response object ...

+2  A: 

This really sounds like a dirty hack but you could get away with it using a MemoryAppender. Here's some sample code on how to get to the log data:

var memoryAppender = (MemoryAppender)LogManager.GetRepository()
    .GetAppenders().Single(x => x.Name == appenderName);

var events = memoryAppender.GetEvents();

After picking the latest events from the appender for rendering you should probably do a

memoryAppender.Clear();
Peter Lillevold