How to use LoggerMessage in ASP.NET Core 3.0

Take advantage of high-performance logging by using LoggerMessage instead of Logger extension methods in ASP.NET Core

How to use LoggerMessage in ASP.NET Core 3.0
Loops7 / Getty Images

ASP.NET Core is an open source, cross-platform, lean, and modular framework for building high-performance, scalable web applications. ASP.NET Core comes up with a built-in logging framework out-of-the-box. It is available as part of the Microsoft.Extensions.Logging namespace.

One of the hidden but powerful features in ASP.NET Core is LoggerMessage, which has reduced overhead compared to the Logger extension methods. This article presents a discussion of the features and benefits of LoggerMessage and how we can work with LoggerMessage in ASP.NET Core 3.0.

To work with the code examples provided in this article, you should have Visual Studio 2019 installed in your system. If you don’t already have a copy, you can download Visual Studio 2019 here

Create an ASP.NET Core 3.0 API project

First off, let’s create an ASP.NET Core project in Visual Studio. Assuming Visual Studio 2019 is installed in your system, follow the steps outlined below to create a new ASP.NET Core project in Visual Studio.

To continue reading this article register now

How to choose a low-code development platform