log4net 会挂起应用程序吗?
我正在使用 ColoredConsoleAppender,我担心它是否会挂起我的应用程序。 谁都有经验
I am using ColoredConsoleAppender, I am worried about if it will ever hang my application.
Anyone has experience
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自 log4net 站点:
http://logging.apache.org/log4net/release/faq.html
不,log4net 不可靠。它是一个尽力而为、故障停止的日志系统。
通过故障停止,我们的意思是 log4net 不会在运行时引发可能导致应用程序崩溃的意外异常。如果出于任何原因,log4net 抛出未捕获的异常(可能抛出的 ArgumentException 和 ArgumentNullException 除外),请发送电子邮件至 [电子邮件受保护] 邮件列表。未捕获的异常将被视为需要立即关注的严重错误。
我个人一直在使用它并且从未遇到过问题。
From the log4net site:
http://logging.apache.org/log4net/release/faq.html
No. log4net is not reliable. It is a best-effort and fail-stop logging system.
By fail-stop, we mean that log4net will not throw unexpected exceptions at run-time potentially causing your application to crash. If for any reason, log4net throws an uncaught exception (except for ArgumentException and ArgumentNullException which may be thrown), please send an email to the [email protected] mailing list. Uncaught exceptions are handled as serious bugs requiring immediate attention.
I personally use it all the time and have never had an issue.
@ralf.w。已经显示出全部症状。我可以重新表述一下,因为我最近也遇到了同样的问题。
然后,在几台计算机(或远程桌面会话)上,log4net 将挂起控制台应用程序,并且在挂起转储中,您可以看到它奇怪地等待对流的写入完成。
很难在普通机器(比如我的)上重现,因此很难进一步研究,尽管 log4net 是开源的。
解决方法可以很简单,只需将控制台应用程序显示为最小化(而不是隐藏),和/或更改其他 ProcessStartInfo 设置。
@ralf.w. already shows the full symptoms. I can rephrase as I recently meet the same issue too.
Then on a few machines (or remote desktop sessions), log4net will hang the console application, and in the hang dumps you can see it weirdly waits for a write to the stream to finish.
Hard to reproduce on a normal machine (like mine), so hard to investigate further though log4net is open source.
The workaround can be as simple as show the console application as minimized (instead of hidden), and/or change other ProcessStartInfo settings.