Does asp net cores built in logging make nlog serilog etc obsolete


ASP.NET is a popular programming language used for building web applications. One of the key features of ASP.NET is its -in logging capabilities. However, is a question that arises: does ASP.NET Core's built-in logging make other logging frameworks like NLog and Serilog ?

Understanding ASP.NET Core Logging

ASP.NET Core provides a and extensible logging framework that allows developers to easily log messages and events in their applications. The logging framework supports various log levels, including Debug, Information, Warning, Error, and Critical. It also supports different logging providers, such as , Debug, EventSource, and File.

// Example of ASP.NET Core logging
public class HomeController : 
     readonly ILogger _logger;

    public HomeController(ILogger logger)
        _logger = logger;

    public IActionResult Index()
        _logger.LogInformation("Hello, ASP.NET Core Logging!");
        return View();

In the above example, we have a simple ASP.NET Core controller that logs an information message using the ILogger interface. The logger is injected into the controller's constructor, allowing us to use it throughout the controller's methods.

Advantages of ASP.NET Core Logging

ASP.NET Core's built-in logging framework offers several advantages:

  • Simplicity: ASP.NET Core logging is easy to set up and use. It provides a straightforward API for logging messages and events.
  • Integration: ASP.NET Core logging integrates seamlessly with other ASP.NET Core components and frameworks.
  • Extensibility: The logging framework allows developers to add custom logging providers and configure logging according to their specific requirements.

When to Use Other Logging Frameworks

While ASP.NET Core's built-in logging is powerful and sufficient for most scenarios, there are cases where using other logging frameworks like NLog and Serilog may still be beneficial:

  • Advanced Logging Features: NLog and Serilog offer additional features and capabilities that may not be available in ASP.NET Core's logging framework. These features include structured logging, log filtering, and log routing.
  • Legacy Applications: If you are working on a legacy application that already uses NLog or Serilog, it may be easier to continue using these frameworks rather than migrating to ASP.NET Core's logging.
  • Preference and Familiarity: Some developers may have a personal preference for NLog or Serilog due to their familiarity with these frameworks. In such cases, it sense to stick with what works best for the developer and the team.


ASP.NET Core's built-in logging framework provides a solid foundation for logging in web applications. It offers simplicity, integration, and extensibility. However, there are scenarios where other logging frameworks like NLog and Serilog may still be preferred due to their advanced features or existing usage in legacy applications. Ultimately, the choice of logging framework depends on the specific requirements and preferences of the team.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents