In this post, I’m going to describe how we can configure Serilog with Asp.Net Core 2 web and Api projects. I also configure Serilog to work with SQL Server database to store the logging information. Then I’ll write an extension method and use the built-in exception handling middleware to log exceptions in production environments. What I’m going to present here is a very simple approach to logging. It can mainly be used with small projects when things doesn’t get complicated. For more complex scenarios what you’ll need is what is called structured logging, maybe a combination of Serilog, ElasticSearch, Kibana. But for now Let’s see how we can setup logging for a small projects.
Installing and Configuring Serilog
Installing and Configuring Serilog