0

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?

萧逸清
  • 165
  • 3
  • 11

1 Answers1

0

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}

Rolf Kristensen
  • 17,785
  • 1
  • 51
  • 70