[英]ASP.NET Web API Logging and Tracing
Once one has a logging and tracing setup using log4net in place for ASP.NET Web API, what are the specific aspects that need to be logged and/or traced? 一旦使用适用于ASP.NET Web API的log4net进行日志记录和跟踪设置,需要记录和/或跟踪的具体方面是什么?
I am asking this specifically from Web API perspective. 我从Web API的角度来看这个问题。 Is there a series of MUST Log this or MUST trace this .
是否有一系列必须记录这个或必须跟踪这个 。 Like, INFO traces about a controller's request, any NULL checks, etc.
比如,INFO跟踪控制器的请求,任何NULL检查等。
Is there a reference list that can be validated against to ensure optimum logging and tracing coverage in ASP.NET Web API ? 是否有可以验证的引用列表,以确保ASP.NET Web API中的最佳日志记录和跟踪覆盖率?
So I will assume your goal for the logging is, as it should be, to debug the application rather than measure for performance. 因此,我将假设您的日志记录目标应该是调试应用程序而不是衡量性能。
While I think there is no one 'right' answer to this, at the minimum I would always try to log 虽然我认为对此没有“正确”的答案,但至少我会一直尝试登录
I'm sure there is more missing from this list - after all this varies on what yr doing in the app. 我确信此列表中还有更多内容 - 毕竟这与您在应用中的操作有所不同。 You should be asking yourself at every step of the way - what could go wrong in my application?
你应该在每一步都问自己 - 我的申请中可能出现什么问题? What things would I or the poor chap that will work on this after me find useful whilst debugging a problem?
在调试问题后,我或者在我之后会对此有用的什么事情会发现有用吗?
If you are hosting your webapi in IIS, you can enable IIS LOG and counters: 如果您在IIS中托管webapi,则可以启用IIS LOG和计数器:
http://www.iis.net/configreference/system.applicationhost/sites/site/logfile http://www.iis.net/configreference/system.applicationhost/sites/site/logfile
Performance Counters: 绩效计数器:
http://msdn.microsoft.com/en-us/library/fxk122b4%28v=VS.100%29.aspx http://msdn.microsoft.com/en-us/library/fxk122b4%28v=VS.100%29.aspx
http://www.iis.net/learn/extensions/configuring-application-request-routing-(arr)/using-performance-counters http://www.iis.net/learn/extensions/configuring-application-request-routing-(arr)/using-performance-counters
An additional category of items to log for a service code that implements authorization authentication and impersonation where elevated access is required. 另一类项目,用于记录服务代码,该服务代码实现授权身份验证和模拟,需要提升访问权限。 These should be configurable to log either success failure or both.
这些应该是可配置的,以记录成功失败或两者。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.