简体   繁体   English

关于日志创建和写入日志FileAppender的Log4Net事件

[英]Log4Net events on log creation and writing to log FileAppender

I am wondering if Log4Net 1.2.13.0 exposes any events that can be subscribed to when it creates or writes to a log file. 我想知道Log4Net 1.2.13.0是否在创建或写入日志文件时公开任何可以订阅的事件。 I am using the FileAppender. 我正在使用FileAppender。 Googling for such an answer has been hard as event log is often found instead of a C# event. 搜寻此类答案非常困难,因为通常会找到事件日志而不是C#事件。

The answer to this question after doing more research is that the FileAppender class itself does not expose events on logging. 经过更多研究后,此问题的答案是FileAppender类本身不会在日志记录中公开事件。 Instead you have to create a custom appender that fires an event in the append method and then subscribe to that. 相反,您必须创建一个自定义的附加程序,该附加程序会在append方法中触发一个事件,然后订阅该事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM