diff --git a/src/Kestrel.Core/Adapter/ListenOptionsConnectionLoggingExtensions.cs b/src/Kestrel.Core/Adapter/ListenOptionsConnectionLoggingExtensions.cs index 11306602c6..ef95004a30 100644 --- a/src/Kestrel.Core/Adapter/ListenOptionsConnectionLoggingExtensions.cs +++ b/src/Kestrel.Core/Adapter/ListenOptionsConnectionLoggingExtensions.cs @@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Hosting /// public static ListenOptions UseConnectionLogging(this ListenOptions listenOptions) { - return listenOptions.UseConnectionLogging(nameof(LoggingConnectionAdapter)); + return listenOptions.UseConnectionLogging(loggerName: null); } /// @@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Hosting public static ListenOptions UseConnectionLogging(this ListenOptions listenOptions, string loggerName) { var loggerFactory = listenOptions.KestrelServerOptions.ApplicationServices.GetRequiredService(); - var logger = loggerFactory.CreateLogger(loggerName ?? nameof(LoggingConnectionAdapter)); + var logger = loggerName == null ? loggerFactory.CreateLogger() : loggerFactory.CreateLogger(loggerName); listenOptions.ConnectionAdapters.Add(new LoggingConnectionAdapter(logger)); return listenOptions; } diff --git a/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs b/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs index 28c729b8d9..e88d71c65c 100644 --- a/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs +++ b/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs @@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal } _options = options; - _logger = loggerFactory?.CreateLogger(nameof(HttpsConnectionAdapter)); + _logger = loggerFactory?.CreateLogger(); } public bool IsHttps => true; diff --git a/test/Kestrel.InMemory.FunctionalTests/HttpsTests.cs b/test/Kestrel.InMemory.FunctionalTests/HttpsTests.cs index 1f3039abbb..51980f6977 100644 --- a/test/Kestrel.InMemory.FunctionalTests/HttpsTests.cs +++ b/test/Kestrel.InMemory.FunctionalTests/HttpsTests.cs @@ -385,7 +385,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests public ILogger CreateLogger(string categoryName) { - if (categoryName == nameof(HttpsConnectionAdapter)) + if (categoryName == TypeNameHelper.GetTypeDisplayName(typeof(HttpsConnectionAdapter))) { return FilterLogger; }