Merge branch 'release/2.2' => 'master'

This commit is contained in:
David Fowler 2018-09-07 01:29:38 -07:00
commit 5543d29af1
1 changed files with 8 additions and 6 deletions

View File

@ -94,7 +94,8 @@ namespace Microsoft.AspNetCore.Hosting.Internal
private class HostingLogScope : IReadOnlyList<KeyValuePair<string, object>> private class HostingLogScope : IReadOnlyList<KeyValuePair<string, object>>
{ {
private readonly HttpContext _httpContext; private readonly string _path;
private readonly string _traceIdentifier;
private readonly string _correlationId; private readonly string _correlationId;
private string _cachedToString; private string _cachedToString;
@ -113,11 +114,11 @@ namespace Microsoft.AspNetCore.Hosting.Internal
{ {
if (index == 0) if (index == 0)
{ {
return new KeyValuePair<string, object>("RequestId", _httpContext.TraceIdentifier); return new KeyValuePair<string, object>("RequestId", _traceIdentifier);
} }
else if (index == 1) else if (index == 1)
{ {
return new KeyValuePair<string, object>("RequestPath", _httpContext.Request.Path.ToString()); return new KeyValuePair<string, object>("RequestPath", _path);
} }
else if (index == 2) else if (index == 2)
{ {
@ -130,7 +131,8 @@ namespace Microsoft.AspNetCore.Hosting.Internal
public HostingLogScope(HttpContext httpContext, string correlationId) public HostingLogScope(HttpContext httpContext, string correlationId)
{ {
_httpContext = httpContext; _traceIdentifier = httpContext.TraceIdentifier;
_path = httpContext.Request.Path.ToString();
_correlationId = correlationId; _correlationId = correlationId;
} }
@ -141,8 +143,8 @@ namespace Microsoft.AspNetCore.Hosting.Internal
_cachedToString = string.Format( _cachedToString = string.Format(
CultureInfo.InvariantCulture, CultureInfo.InvariantCulture,
"RequestId:{0} RequestPath:{1}", "RequestId:{0} RequestPath:{1}",
_httpContext.TraceIdentifier, _traceIdentifier,
_httpContext.Request.Path); _path);
} }
return _cachedToString; return _cachedToString;