-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
If a SocketException exception is thrown while the SocketConnectionListener
is accepting a new connection, the logger will still log, even if the logger is disabled
No IsEnabled
check in the call position:
https://github.com/dotnet/aspnetcore/blob/release/7.0/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionListener.cs#L90
https://github.com/dotnet/aspnetcore/blob/release/6.0/src/Servers/Kestrel/Transport.Sockets/src/SocketConnectionListener.cs#L90
And explicitly skip the check on the code generation:
https://github.com/dotnet/aspnetcore/blob/release/7.0/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketsLog.cs#L50
https://github.com/dotnet/aspnetcore/blob/release/6.0/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketsTrace.cs#L70
Expected Behavior
The expected behavior is to call to IsEnabled
at some point and not log if a call to it should return false
Steps To Reproduce
Implement Microsoft.Extensions.Logging.ILogger
Implement the Log
method to only log without checking if should log (relay only on IsEnabled
)
Define the system to use the custom logger.
Start a socket connection and reset it while the server accepts it (I didn't find how to do that).the
Exceptions (if any)
No response
.NET Version
6.0, 7.0