Serilog in ASP.NET Core — Console, File, Enrichment & PostgreSQL in 10 Minutes

Опубликовано: 17 Май 2026
на канале: dotnetexplained
372
0

In this quick tutorial, I’ll walk you step by step through setting up *Serilog* in an ASP.NET Core project.
We’ll start simple with console logging and log levels, then move configuration into `appsettings.json`, add file logging, record structured event data, enrich logs with *ThreadId* and **CorrelationId**, and finally send everything to **PostgreSQL**.

🚀 Perfect for .NET developers who want production-ready logging in just a few minutes.

What you’ll learn:
00:00 – Intro
00:25 – Install Serilog packages
00:50 – Console sink setup
01:10 – Log levels explained
01:42 – Using Log vs ILogger
02:40 - AppSettings for Serilog
04:33 - Log To File
05:30 – Structured event logging with models
06:50 – Enrichment (ThreadId)
07:30 – Logging HTTP requests
08:00 – PostgreSQL sink
09:00 – Conclusion

💡 Don’t forget to *like & subscribe* if you found this useful!

#dotnet #aspnetcore #serilog #logging #developers #csharp #postgresql #softwareengineering #dotnetcore #backend