This repository was archived by the owner on Dec 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 515
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
Log TraceIdentifier for ApplicationErrors #1367
Copy link
Copy link
Closed
Description
If we implemented IHttpRequestIdentifierFeature in Frame.FeatureCollection.cs, we would have access to the TraceIdentifier (Request ID) instead of just the ConnectionId. I think Kestrel should log both identifiers when possible. I think something (maybe Hosting) should log which TraceIdentifiers correspond with which ConnectionIds for every request.
Hosting should just pick up our implementation of IHttpRequestIdentifierFeature instead of adding the one from HttpAbstractions to the IFeatureCollection.
Below are the current logs from an unhandled exception fro a request with TraceIdentifier: 0HL2MNKLICAB4 and ConnectionId: 0HL2MNKLGDKRK.
~\dev\Universe\KestrelHttpServer\samples\SampleApp [pakrym/pipelines-halter73/sync +0 ~1 -0 !]> dotnet run -c Release -f netcoreapp1.1
Startup.cs(27,17): warning CS0162: Unreachable code detected [C:\Users\shalter\dev\Universe\KestrelHttpServer\samples\SampleApp\SampleApp.csproj]
Hosting environment: Production
Content root path: C:\Users\shalter\dev\Universe\KestrelHttpServer\samples\SampleApp
Now listening on: http://127.0.0.1:5000
Now listening on: http://127.0.0.1:5001
Application started. Press Ctrl+C to shut down.
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HL2MNKLGDKRK": An unhandled exception was thrown by the application.
System.Exception: test
at SampleApp.Startup.<>c__DisplayClass0_0.<<Configure>b__0>d.MoveNext() in C:\Users\shalter\dev\Universe\KestrelHttpServer\samples\SampleApp\Startup.cs:line 25
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.<RequestProcessingAsync>d__2.MoveNext() in C:\Users\shalter\dev\Universe\KestrelHttpServer\src\Microsoft.AspNetCore.Server.Kestrel\Internal\Http\FrameOfT.cs:line 139
Reactions are currently unavailable