log4net - 丢失日志
我们在许多服务中使用 log4net。大多数时候它都能完美地工作。然而,我们偶尔会看到 log4net 在继续正常工作之前“冻结”一段时间。例如,下面的日志显示 log4net 被“冻结”了 4 个多小时。我们知道这个应用程序很冗长,因此我们希望看到每秒写入的日志。
2010-11-04 04:02:09,393 DEBUG Some message...
2010-11-04 08:48:07,114 DEBUG Some other message...
我们偶尔会看到的另一个问题是整个日志文件被删除。我们将 log4net 配置为按日期滚动。有时我们会发现整整一周的日志都丢失了。 log4net是否错误地删除了这些日志文件?我们没有配置 log4net 来保存大量日志。
以前有人遇到过这种情况吗?
We're using log4net in a number of our services. Most of the time it works flawlessly. However, we'll occasionally see log4net "freezes" for a period of time before continuing to work normally. For example, the logs below shows that log4net was "frozen" for over 4 hours. We know this application is verbose, so we expect to see logs written every second.
2010-11-04 04:02:09,393 DEBUG Some message...
2010-11-04 08:48:07,114 DEBUG Some other message...
Another problem we'll occasionally see is that entire log files get deleted. We have log4net configured to roll over by date. Sometimes we'll see that an entire weeks worth of logs go missing. Is log4net mistakenly deleting these logs files? We do not have log4net configured to keep a number of logs.
Has anyone encountered this before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还没有看到这一点,但请记住 Log4net 被设计为即使无法记录其信息也能继续 - 请参阅此常见问题解答文章
如果有任何内容锁定日志文件(例如备份/防病毒),那么您将得到丢失的信息。
您可以尝试运行 DebugView 来查看日志记录时是否出现任何此类警告失败或者可能配置 log4net 以保留自己的日志(请参阅 另一个常见问题解答文章)
I have not seen this, but remember that Log4net is designed to continue even if it can not log its information - See this FAQ Article
If anything locks the log file (eg Backup/AntiVirus) then you will get missing information.
You could trying running DebugView to see if any such warning appears when the logging fails or perhaps configure log4net to keep its own logs (see another FAQ Article )