How to properly perform logging in .NET Core applications

Amir Kamali
8 min readApr 15, 2022

Logging is one of the most important parts of the web applications. When there are incidents or warnings, logs are the best tools available to investigate the issues. You probably don’t want your boss, team members or customers calling your website or service buggy. The underlying issue may not have originated from your code and it can be more frustrating if you don’t know how to identify and replicate the issue! If you have a good logging mechanism in place, next time someone complains, you can quickly pinpoint the exact cause of the issue!

In this article, I describe the definition and importance of logs, metrics and tracing as well as several aspects of logging and best practices in web applications. I also describe how to integrate SeriLog for structured logging for .NET core applications. I further deep dive into more advanced scenarios and describe how you can use logging to help you to trace issues in micro service environments.

Logs, Metrics and Tracing

Logs are a valuable business tool because they provide an overview of web traffic. Web applications and services receive a lot of traffic everyday, and having a high availability is essential to almost all businesses. As a result, many companies use advanced web monitoring tools to oversee their website’s traffic…

--

--

Amir Kamali

Application Architect, Apple | ex. Director of Mobile & OTT at AMC Networks, ex. Engineering Manager at Tile / Life360