I'm wondering how ASP.NET Core and Microsoft.Extensions.Logging assigns TraceId
, RequestId
, and TraceIdentifier
. When looking through my log after making a request to my website I see the following information logged from Microsoft.Extensions.Logging:
TraceId: e57eb4708135dd43a914ee9e98165b1b
RequestId: 80000389-0006-ee00-b63f-84710c7967bb
I also log errors happening from ASP.NET Core through custom middleware. On the same request as above I see an error in the same log with the following information:
TraceIdentifier: 80000389-0006-ee00-b63f-84710c7967bb
The value 80000389-0006-ee00-b63f-84710c7967bb
looks like the request GUID assigned by ASP.NET Core which makes sense when looking at the RequestId
property from Microsoft.Extensions.Logging. But ASP.NET Core logs the request id as TraceIdentifier
which feels a little weird.
I would personally prefer having the value from Microsoft.Extension.Logging's TraceId
in the TraceIdentifier
property when doing custom logging from ASP.NET Core middleware. Any input would be appreciated.
Update - Since writing this question I did create an issue on GitHub which were pretty much ignored and then closed because of inactivity :( https://github.com/dotnet/aspnetcore/issues/31747