[在此处插入您最喜欢的日志记录库]相对于 System.Diagnostics.Trace 有什么优势?
如果我忽略了它,我很抱歉,但我无法立即找到类似的问题。
.Net 带有一些内置的日志记录功能(本质上是 System.Diagnostics.Debug 和 System.Diagnostics.Trace)。
是否有充分的理由不在典型的 LOB 应用程序中使用这些内置设施进行日志记录,而是使用 log4net、NLog、EntLib 日志记录块或[在此处插入您最喜欢的日志记录库]?
编辑:请注意,我更感兴趣的是查明 System.Diagnostics 日志记录功能的缺点,而不是不同日志记录库的功能。
Apologies if I overlooked it but I couldn't immediately find a similar question on SO.
.Net comes with some built-in logging capabilities (essentially, System.Diagnostics.Debug and System.Diagnostics.Trace).
Is there a good reason not to use these built-in facilities for logging purposes in a typical LOB application, and instead use log4net, NLog, EntLib logging block or [insert your favourite logging library here]?
EDIT: note that I am more interested in pinpointing the shortcomings of System.Diagnostics w.r.t. logging capabilities, rather than the features of the different logging libraries.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我更喜欢使用 NLog 或 log4net,因为它为我提供:
I prefer to use NLog or log4net because it gives me:
能够将日志发送到多个端点(系统日志、数据库、事件日志等)可能会很有用。
Being able to send your logs to multiple endpoints (syslog, database, event log, etc) can be useful.
我使用 log4net,它的优点是在配置文件中您可以选择所需的日志记录级别(严重、错误、警告、信息、调试),并且您可以免费获得电子邮件日志记录和滚动日志文件等内容。
I use log4net and it's advantages are that in configuration files you can choose what level of logging you require (Critical, Error, Warning, Information, Debug) and you get things like email logging and rolling log files for free.
对于.net,我喜欢使用 http://netcommon.sourceforge.net/ doc-latest/reference/html/logging.html。它基本上是上面的包装层,因此在下面,您可以轻松切换日志引擎。不过它很像 log4net。
还有:
http://commons.apache.org/logging/guide.html
For .net, I like using http://netcommon.sourceforge.net/doc-latest/reference/html/logging.html. It's basically a wrapper layer above, so underneath, you can switch logging engines easily. It's very log4net like though.
There is also:
http://commons.apache.org/logging/guide.html