Welcome to my blog!

Serilog in .Net Core

August 20, 2021 22:49

Serilog (edit)

@devlead Console Template

dotnet new --install Devlead.Console.Template


Application log files play an important role in analyzing the bugs and for troubleshooting issues in an application. It’s worth noting that the log files are also used for writing information about events and other information that occurs when the application is running or serving requests in the case of a web application. Most application developers use a single file to log everything from errors, warnings, debug information, etc. There is no harm in following this approach, but the downside is that it will be harder for you to segregate information from the file easily. We can easily overcome this by maintaining multiple log files depending on the need. In this post, I am going to show how we can achieve this with Serilog.

Serilog is a popular third party diagnostic logging library for .NET applications, I have already written some post about it and it’s usage already. If you are new to Serilog, please refer to those posts using the links given below.

Console Application Template

ShawnShiSS/aspnetcore-console-app-template: A starting template for ASP.NET Core 3.1 Console application that supports dependency injection, asynchronous programming, logging using Serilog, strongly-typed configuration, etc.. (github.com)

Console Application Entity Framework Core

Getting Started With Entity Framework Core - Console | Learn Entity Framework Core


Recent posts