@@ -15,7 +15,7 @@ internal static class HostingLoggerExtensions
1515 {
1616 public static IDisposable RequestScope ( this ILogger logger , HttpContext httpContext , string activityId )
1717 {
18- return logger . BeginScope ( new HostingLogScope ( httpContext , activityId ) ) ;
18+ return logger . BeginScope ( new HostingLogScope ( httpContext ) ) ;
1919 }
2020
2121 public static void ApplicationError ( this ILogger logger , Exception exception )
@@ -96,15 +96,14 @@ private class HostingLogScope : IReadOnlyList<KeyValuePair<string, object>>
9696 {
9797 private readonly string _path ;
9898 private readonly string _traceIdentifier ;
99- private readonly string _activityId ;
10099
101100 private string _cachedToString ;
102101
103102 public int Count
104103 {
105104 get
106105 {
107- return 3 ;
106+ return 2 ;
108107 }
109108 }
110109
@@ -120,22 +119,17 @@ public KeyValuePair<string, object> this[int index]
120119 {
121120 return new KeyValuePair < string , object > ( "RequestPath" , _path ) ;
122121 }
123- else if ( index == 2 )
124- {
125- return new KeyValuePair < string , object > ( "ActivityId" , _activityId ) ;
126- }
127122
128123 throw new ArgumentOutOfRangeException ( nameof ( index ) ) ;
129124 }
130125 }
131126
132- public HostingLogScope ( HttpContext httpContext , string activityId )
127+ public HostingLogScope ( HttpContext httpContext )
133128 {
134129 _traceIdentifier = httpContext . TraceIdentifier ;
135130 _path = ( httpContext . Request . PathBase . HasValue
136131 ? httpContext . Request . PathBase + httpContext . Request . Path
137132 : httpContext . Request . Path ) . ToString ( ) ;
138- _activityId = activityId ;
139133 }
140134
141135 public override string ToString ( )
@@ -144,10 +138,9 @@ public override string ToString()
144138 {
145139 _cachedToString = string . Format (
146140 CultureInfo . InvariantCulture ,
147- "RequestPath:{0} RequestId:{1}, ActivityId:{2} " ,
141+ "RequestPath:{0} RequestId:{1}" ,
148142 _path ,
149- _traceIdentifier ,
150- _activityId ) ;
143+ _traceIdentifier ) ;
151144 }
152145
153146 return _cachedToString ;
0 commit comments