Site icon NodeXperts

Logging using Serilog- ASP .Net Core 5

Less Configuration from other loggers. 

Steps

  1. Create an ASP .Net Core Web Application project name as “SeriLogger.”
  2. Add/Create class library name as “Logger” in .Net core into the SeriLogger project and add a reference into the Serilogger.
  3. Add below NuGet packages in the “Logger” class library. 

  1. Create a new class in Logger class library “HostBuilderExtensions”

  1. Add Serilog configuration in appsettings.json and appsettings. Development.json and remove default logging from both JSON files.

6.Add Serilog into startup.cs file.

7.Use into the controller like this

GitHub Link : XearoSeriLog

I hope you like the article. If you find the article interesting, kindly like and share it.