@@ -15,7 +15,7 @@ internal static class HostingLoggerExtensions
15
15
{
16
16
public static IDisposable RequestScope ( this ILogger logger , HttpContext httpContext , string activityId )
17
17
{
18
- return logger . BeginScope ( new HostingLogScope ( httpContext , activityId ) ) ;
18
+ return logger . BeginScope ( new HostingLogScope ( httpContext ) ) ;
19
19
}
20
20
21
21
public static void ApplicationError ( this ILogger logger , Exception exception )
@@ -96,15 +96,14 @@ private class HostingLogScope : IReadOnlyList<KeyValuePair<string, object>>
96
96
{
97
97
private readonly string _path ;
98
98
private readonly string _traceIdentifier ;
99
- private readonly string _activityId ;
100
99
101
100
private string _cachedToString ;
102
101
103
102
public int Count
104
103
{
105
104
get
106
105
{
107
- return 3 ;
106
+ return 2 ;
108
107
}
109
108
}
110
109
@@ -120,22 +119,17 @@ public KeyValuePair<string, object> this[int index]
120
119
{
121
120
return new KeyValuePair < string , object > ( "RequestPath" , _path ) ;
122
121
}
123
- else if ( index == 2 )
124
- {
125
- return new KeyValuePair < string , object > ( "ActivityId" , _activityId ) ;
126
- }
127
122
128
123
throw new ArgumentOutOfRangeException ( nameof ( index ) ) ;
129
124
}
130
125
}
131
126
132
- public HostingLogScope ( HttpContext httpContext , string activityId )
127
+ public HostingLogScope ( HttpContext httpContext )
133
128
{
134
129
_traceIdentifier = httpContext . TraceIdentifier ;
135
130
_path = ( httpContext . Request . PathBase . HasValue
136
131
? httpContext . Request . PathBase + httpContext . Request . Path
137
132
: httpContext . Request . Path ) . ToString ( ) ;
138
- _activityId = activityId ;
139
133
}
140
134
141
135
public override string ToString ( )
@@ -144,10 +138,9 @@ public override string ToString()
144
138
{
145
139
_cachedToString = string . Format (
146
140
CultureInfo . InvariantCulture ,
147
- "RequestPath:{0} RequestId:{1}, ActivityId:{2} " ,
141
+ "RequestPath:{0} RequestId:{1}" ,
148
142
_path ,
149
- _traceIdentifier ,
150
- _activityId ) ;
143
+ _traceIdentifier ) ;
151
144
}
152
145
153
146
return _cachedToString ;
0 commit comments