为什么 log4Net 中没有跟踪级别?
我只是想知道为什么没有 跟踪级别 在 log4Net 中。这个级别似乎缺失,我有时觉得需要使用它,例如输出应用程序中正在执行的事件。此功能是 log4J 的一部分。
我知道我可以创建一个自定义级别,就像此处讨论的那样,但我不想这样做把时间和精力花在我认为应该成为图书馆本身一部分的事情上。
您是否知道实现此功能的 log4net 扩展库或者为什么这不是 .net 端口的一部分?
I was just wondering why there isn't a trace level in log4Net. This level seems to be missing and I sometimes feel the need to use it, for example to output what events are being executed in an application. This feature is a part of log4J.
I know I can create a custom level like is talked about here but I don't want to put time and effort in something I feel should be part of the library itself.
Do you know about a log4net extension library that implements this or why this wasn't a part of the port to .net ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用扩展方法向 log4net 添加详细(或跟踪级别)。这就是我正在使用的:
使用示例:
来源:
http://www.matthewlowrance.com/post/2010/07/14/Logging-to-Trace-Verbose-etc-with-log4net.aspx
You can add a Verbose (or Trace level) to log4net by using extension methods. This is what I'm using:
Usage example:
Source:
http://www.matthewlowrance.com/post/2010/07/14/Logging-to-Trace-Verbose-etc-with-log4net.aspx
log4net.Core.Level 类中有一个跟踪级别 http://logging.apache.org/log4net/release/sdk/html/F_log4net_Core_Level_Trace.htm
There is a trace level in the log4net.Core.Level class http://logging.apache.org/log4net/release/sdk/html/F_log4net_Core_Level_Trace.htm
log4net.ILog 接口仅公开 Fatal、Error、Warn、Info 和 Debug 级别的方法和属性。
我同意这有点限制,并且希望在那里看到更多的级别。但最佳的关卡数可能是“比当前的关卡数多一级”——你总会发现自己偶尔想要多一级。
The log4net.ILog interface only exposes methods and properties for Fatal, Error, Warn, Info and Debug levels.
I agree this is a bit limiting and would like to see one more level in there. But then the optimal number of levels is probably "one more than the current number of levels" - you'll always find yourself occasionally wanting one more level.