We use NLog or Serilog to do logging. We're busy porting a system from ASP.NET to ASP.NET Core, which has logging built in.
Ideally, we'd like to drop NLog, as there doesn't appear to be a need for it anymore.
However, is the built in logging equivalent to NLog? Is it missing any major features? Is there any point in continuing using NLog (or something similar e.g. Serilog)?
Both logging frameworks have support for a lot of different data stores. As of the writing of this post, Serilog has 81 available sinks and NLog has 82. When comparing the two, the number of sinks isn't really important, but it's a good indicator of a popular and well-supported framework.
Serilog is a robust API for logging with many configurations and sinks (outputs) and it is straightforward to get started in any . NET version. With . NET 6 the way we used to configure Serilog as a logging provider in .
Formatting. Log4Net is an add-on for Serilog to format log events as log4net or log4j compatible XML format. You can use Log4View to look at log files produced with this formatter.
The ASP.NET logging is a common (logging) interface and log implementation.
You could use the common interface and 3rd party library (e.g NLog) together as the infrastructure is prepared for that.
If you take NLog over the built-in logging implementation you win:
${processid}
But as always, if you don't need these features then maybe less (libraries) is more.
I wouldn't say that ASP.NET Core's logging API makes NLog and other providers obsolete. What ASP.NET Core provides is a nice abstraction so logging frameworks can be switched without changing code that depends on logging.
Nlog still provides useful configuration features that are not implemented in ASP.NET Core logging API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With