Start log scope only if logging is enabled

This commit is contained in:
Ben Adams 2015-09-26 14:34:49 +01:00
parent c426fa97d5
commit 7e52a00499
1 changed files with 3 additions and 1 deletions

View File

@ -104,7 +104,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)
{
contextAccessor.HttpContext = httpContext;
await application(httpContext);