Log4Net FileAppender 不是线程安全的?
我需要登录到文件,因为客户没有可以使用 log4net 登录的控制台。 现在我读到 FileAppender 不是线程安全的。无论如何,有没有一种方法可以在退出不同线程的应用程序中登录到文件,或者什么是常见的替代方案?
I need to log to a file because the customer doesn't have a console of something where I can log to with log4net.
Now I read that the FileAppender is not thread safe. Is there anyhow a way to log to file within an app that logs out of different threads or what would be a common alternative?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Log4Net 本身 是线程安全的,即使
FileAppender
不是 - 框架会为您管理一切。只要您以正常方式登录(而不是直接写入附加程序),就应该没问题。Log4Net itself is thread-safe even if
FileAppender
isn't - the framework manages everything for you. So long as you log in the normal way (rather than directly writing to the appender) you should be fine.