tags:

views:

13

answers:

1

I'm looking for a way for a command line program to be able to email its log4net output to a group of users. Right now, I'm reading the log file but I have to call log4net.LogManager.Shutdown() to release the file so I can read it, and I have to either hard code the log file name or parse the log4net configuration for it. I'd like to be able to configure an additional appender that logs to an in memory location that I can then read from.

I don't mind creating a new appender for this functionality, but I'm not sure what the best option is. I certainly don't want to rely on another file, database, or external data source just to get my log output.

+3  A: 

Yes, there is log4net.Appender.MemoryAppender. It has a GetEvents() method that you can use to obtain the events that have been logged.

Mark Rushakoff
Now, I looked at the list of build in appenders and did not see that. I swear I must be blind. +1 for calling me out on it.
Chris