您会推荐哪种日志记录工具/方法?
我今天将为我的应用程序添加日志记录(滚动文本文件 + Windows 事件源),以便以后的应用程序调试变得可能且更容易。
我之前使用过 Log4Net 和 Enterprise Library Logging Application Block,现在正在考虑使用什么工具。我已经看过[现有工具的比较][1]。
但理想情况下,我想使用本机 .NET 类,例如 System.Diagnostics 中的类,以便它可以在任何项目、任何具有最高性能的客户端上使用。有任何示例应用程序吗?
您使用过哪种日志记录工具/方法,您会推荐哪种日志记录工具/方法?
谢谢,
I'm going to add Logging (to rolling text file + windows event source) for my application today so that later application debugging can be made possible and easier.
I've previously used Log4Net and Enterprise Library Logging Application Block and now thinking what tool to use. I've seen [this comparison of existing tools][1].
but ideally, I'd like to use native .NET classes such as classes in System.Diagnostics so that it can be used on any project, any client with highest performance. any sample application?
Which logging tool/approach have you worked with and would you recommend?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想推荐 log4Net
i would like to recommend log4Net
我将使用 log4net 与 FileAppender:
http://logging.apache.org/log4net /release/config-examples.html
您可以通过在每次日志调用之前进行检查来确保日志记录尽可能快,即如果您没有配置相应的级别,则如下所示停止进行调用:
这是您所能达到的最快速度。
确保在类中将记录器定义为静态成员,即所有实例都有一次性实例化成本:
企业库日志记录存在一些严重的性能问题,因此我会像避免瘟疫一样避免它。
I would use log4net with the FileAppender:
http://logging.apache.org/log4net/release/config-examples.html
You can make sure that the logging is as fast as possible by doing checks before each log call i.e. as follows to stop the calls being made if you do not have the respective level configured:
This is as fast as you will get.
Make sure you define a logger inside your class as a static member i.e. then you have a one-time instantiation cost for all instances:
Enterprise library logging has some serious performance problems so I'd avoid it like the plague.