开发者

Is there a log4net memory appender?

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 lo开发者_如何学编程cation 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.


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


Wouldn't the SmtpAppender be more appropriate for this use? It emails directly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜