-
Notifications
You must be signed in to change notification settings - Fork 208
Description
Description
The readme states the following for the UseSerilogRequestLogging()
method:
The middleware will not time or log components that appear before it in the pipeline.
This seems to be not true for health check endpoints (HealthCheckMiddleware
). Requests to those are always logged (and therefore cause log spam).
Reproduction
Add the following to a ASP.NET Core 7 project that uses Serilog:
builder.Services.AddHealthChecks();
[...]
app.MapHealthChecks("/healthz");
app.UseSerilogRequestLogging();
Expected behavior
Since MapHealthChecks()
is called before UseSerilogRequestLogging()
I do not expect to see any log lines from RequestLoggingMiddleware
for calls to the health check endpoint.
Relevant package, tooling and runtime versions
Serilog.AspNetCore 7.0.0 on .NET 7
Additional context
There are ways to disable the health check request logging manually, as described in #121 (comment). But I think it should either work as documented by default, or at least mention this case (including solutions) in the readme.