Posts about Logging

Logging from .NET to Elasticsearch

December 6th 2024 .NET Logging Elasticsearch

Although you might have not heard often of Elasticsearch being used for collecting logs from a .NET application, the scenario is well-supported. The setup is simple and it works good.

High performance logging in .NET

May 10th 2024 Logging .NET

You're probably used to standard extension methods for logging. If you use them in recent versions of .NET, you might encounter a warning if you have the analysis level for .NET analyzers set to at least latest recommended.

Request ID middleware in ASP.NET Core

February 2nd 2024 Logging .NET Azure

In a previous post, I wrote about the built-in log correlation features for ASP.NET Core when logging to Application Insights. But what if you want to log elsewhere or want more control over the correlation ID? A custom middleware could be all you need.

ASP.NET Core log correlation in Azure

January 19th 2024 Logging .NET Azure

If you're hosting your ASP.NET Core application in Azure, you're most likely collecting your logs in Application Insights. Make sure you configure the logging in your application correctly to take advantage of built-in support for per-request log correlation.

Benefits of structured logging

January 12th 2024 Logging .NET Azure

After you create a new .NET 8 project, you'll soon notice many new diagnostics being enabled by default. If you're using string interpolation in your logging calls, it will now result in code suggestions in your error list.

Unit Testing log4net Logging Code

January 20th 2014 Logging Unit Testing

There's usually no need to unit test the logging code. If you just want to ignore it in your tests, there's nothing you need to do when using log4net. If you want to make sure you're going to log the right information, you can use MemoryAppender in your unit tests.