diff --git a/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs b/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs index 6ecfb793ee..6d92a39688 100644 --- a/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs +++ b/src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs @@ -105,7 +105,9 @@ namespace Microsoft.AspNet.Hosting.Internal try { - using (logger.BeginScope("Request Id: {RequestId}", requestIdentifier)) + using (logger.IsEnabled(LogLevel.Critical) + ? logger.BeginScope("Request Id: {RequestId}", requestIdentifier) + : null) { await application(httpContext); }