Event Logs in .NET Core Worker Application

Introduction

Logging is essential for software development practices, but it’s often underestimated until the program crashes. Logging serves numerous purposes including root cause analysis, bug analysis, and even performance reviews for the application.

There are great many libraries and approaches about how to incorporate Logging in your application. But sometimes we just need very basic level of logging and bringing in a big framework for this requirement might be an over kill.

In this post, we will see how to start with simple event logging in a .NET Core Worker application.

Setting the Scene

I started by creating a .NET Core Worker Service project as shown below:

A worker service is a .NET project built using a template which supplies a few useful features that turn a regular console application into something more powerful. A worker service runs on top of the concept of a host, which maintains the lifetime of the application. The host also makes available some familiar features, such as dependency injection, logging and configuration.

Worker services will generally be long-running services, performing some regularly occurring workload.

Subscribe to continue reading

Subscribe to get access to the rest of this post and other subscriber-only content.