gpt4 book ai didi

c# - ASP.Net Web Api 2 中内置的跟踪是否仅适用于非生产环境?

转载 作者:行者123 更新时间:2023-11-30 23:06:23 25 4
gpt4 key购买 nike

我读了Global Error Handling建议和 Tracing in Web API 2文章,我了解如何设置这些东西。但是,我注意到在错误处理部分,它指出:

While Web API does have tracing infrastructure that captures error conditions the tracing infrastructure is for diagnostics purposes and is not designed or suited for running in production environments. Global exception handling and logging should be services that can run during production and be plugged into existing monitoring solutions

我正在寻求对此的澄清。这个声明是说错误应该只在不在生产中时记录为跟踪的一部分,还是说 ITraceWriter 的自定义实现?应该只用 HttpConfiguration 注册什么时候不生产?

我假设文章说

not designed or suited for running in production environments

只是为了性能影响,但是我可以通过查看 Exception 来查看特定错误的一些不同的上下文信息吗?在 TraceRecord 上与 Exception被传递到 IExceptionLogger

最佳答案

按照所写的内容,它是一种基本的跟踪和日志记录形式,但由于性能和功能原因,它虽然适用于开发人员和诊断环境,但不适用于生产环境。

为了尽职调查,它建议使用进程外服务(例如,在单独的进程中使用 log4net 或从 Azure 中选择),以减少由于核心进程中的故障而导致日志记录失败的可能性;扩展性能的空间;以及默认设计中未提供的功能更丰富的日志系统的潜力。

关于c# - ASP.Net Web Api 2 中内置的跟踪是否仅适用于非生产环境?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48235479/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com