finds.dev← search

// the find

serilog/serilog-aspnetcore

★ 1,427 · C# · Apache-2.0 · updated Nov 2025

Serilog integration for ASP.NET Core

The official glue package between Serilog and ASP.NET Core. It replaces the default Microsoft.Extensions.Logging implementation with Serilog and adds request logging middleware that collapses ASP.NET Core's chatty per-request events into a single structured log entry. Anyone using Serilog in a .NET web app needs this.

The request logging middleware is genuinely useful — one event per HTTP request with method, path, status code, and elapsed time beats the default five-event flood. IDiagnosticContext.Set() lets you attach domain properties (user ID, tenant, whatever) to the request completion event without emitting separate log entries. Two-stage initialization is a real solution to a real problem: you get a working logger during startup configuration, then swap it out for the fully DI-aware version once the host is built. The versioning strategy of tracking Microsoft.Extensions.Hosting version numbers is sensible and makes it obvious which NuGet version to install.

The source is tiny — RequestLoggingMiddleware.cs and a handful of extension methods — so 'integration package' is more accurate than 'library'. There's almost no test coverage visible: one test file covering the host builder extensions, nothing testing the middleware behavior directly. The two-stage initialization story, while functional, requires duplicating sink configuration in two places or you silently lose startup logs to the bootstrap logger; the README warns about this but it's an easy mistake. No async sink concerns are addressed here — if your Serilog pipeline has async sinks that buffer in memory and the process crashes, that's your problem to solve elsewhere.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →