`system.diagnostics.trace`和nlog/log4net之间的关系是什么?
我正在学习ASP.NET Web API(框架,而不是核心)。通常,我将使用system.diagnostics.trace
编写日志。但是一个兄弟建议使用nlog。
nlog/log4net
system.diagnostics.trace
的包装器吗?它会覆盖system.diarostics.trace
的内置行为吗?什么是Microsoft扩展记录
和nlog.extensions.logging
?
如果我使用nlog,系统是否会从.NET Framework
中登录也可以转到nlog
目标?
我对上述概念感到困惑,您能帮我吗?
I am learning asp.net web API (framework, not core). generally, I will use system.diagnostics.trace
to write logs. but a bro suggests to use Nlog.
is Nlog/log4net
a wrapper of system.diagnostics.trace
? will it override the built-in behavior of system.diagnostics.trace
? And what are Microsoft Extension Logging
and NLog.Extensions.Logging
?
if I use Nlog, will the system log from .Net framework
also turn to Nlog
target?
I am confused with above concepts, can you help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
nlog.extensions.logging.logging 和
关于
System.diagnostics.trace
的好处是,它不会添加任何额外的依赖项。NLOG / LOG4NET / SERILOG的好处是,它们使它们很容易将Loggging-Output重定向到许多不同的目标(File / Console / Console / Database / email /等),并为如何配置输出的布局 - 版本提供了许多选项(JSON / CSV / PLAIN-TEXT)。
example nlog.web.web for asp.net classic //nlog-project.org/config/?tab=layout-renderers&search = package:nlog.web“ rel =” nofollow noreferrer“> nlog extensions to nlog 以便于捕获Web-Request的上下文。前任。 $ {aspnet-request-urll}
NLog.Extensions.Logging and NLog.Web.AspNetCore is for Microsoft Extension Logging in ASP.NET Core.
The nice thing about
system.diagnostics.trace
is that it doesn't add any extra dependencies.The nice thing about NLog/log4net/Serilog is that they make it easy to redirect logging-output to many different targets (file / console / database / email / etc.) and provides many options for how configure the layout-format of the output (json / csv / plain-text).
Forexample NLog.Web for ASP.NET Classic provides extensions to NLog for easy capture context of the web-request. Ex. ${aspnet-request-url}