A good example of a custom log4net application outputting text directly to an asp.net control (custom control, shortcut, etc.)?

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

0


source to share


1 answer


This does sound like a dirty hack, but you can get away with it using MemoryAppender. Here are some code examples on how to get to the log data:

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

var events = memoryAppender.GetEvents();

      



After selecting recent events from your renderer, you should probably do

memoryAppender.Clear();

      

+3


source







All Articles