什么时候写log4net的或提交的日志文件? [英] When does log4net write or commit the log to file?

查看:235
本文介绍了什么时候写log4net的或提交的日志文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用log4net的记录的WinForm应用程序的事件和错误。
我们的客户想要的应用程序运行过程中检查日志文件。
但我不能找出何时和log4net的怎么办写入(提交)操作。
和如何满足客户的需求,除由自己创造的另一个记录器。
任何帮助吗?谢谢你。

We use the log4net to log the winform application's event and error. Our customer want check the log file during the application running. But I can't find out when and how the log4net do the write(commit) operation. And how to meet the customer's requirement, except creating another logger by myself. Any help? Thanks.

推荐答案

如果你使用的 FileAppender ,此附加目的地继承的 TextWriterAppender ,这又暴露的 ImmediateFlush 财产。此属性的值是真正默认情况下,并强制附加器做了一个同花顺()底层流上每个追加操作。

If you're using the FileAppender, this appender inherits the TextWriterAppender, which in turn exposes the ImmediateFlush property. The value of this property is true by default, and forces the appender to do a Flush() on the underlying stream for each Append operation.

取决于你如何想象顾客监督的日志文件,一个想法可能是从你的应用程序中启用监视。这可以通过除了追加到文件中进行,使用的MemoryAppender 和阅读从appender的事件。

Depending on how you envision the customer "monitoring" the log file, an idea could be to enable monitoring from within your application. This can be done by in addition to appending to a file, using the MemoryAppender and reading events from that appender.

这篇关于什么时候写log4net的或提交的日志文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆