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/log.net
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?
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/log.net/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. ${as.net-request-url}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.