How to add the current user id to every log entry in ASP.NET Core
A BeginScope middleware misses the exception handler's error log and the Request finished line. Register an ILogEnricher that reads the user from IHttpContextAccessor, open a scope only when work leaves the request, and watch out for Serilog's AddSerilog silently cancelling enrichment.