Avoid logging bad requests as application errors if the connection was aborted by adityamandaleeka · Pull Request #60359 · dotnet/aspnetcore (original) (raw)

Change the behavior in Kestrel's request processing logic so that bad requests are only logged as errors if the connection has not been aborted. This reduces noise in the logs for common client errors.

We already expose bad request information via Microsoft.AspNetCore.Server.Kestrel.BadRequests so anyone who is interested in seeing all of this already has a mechanism for doing so, and we don't show scary "fail" messages to people who don't care.

This issue has been a source of great frustration for years now (#23949), and generally, there's nothing the server dev can do when there's an unexpected client behavior (e.g. aborting a connection before completing a request) so this seems like a sane default.

Fix #23949