Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
Official documentation HTTP Logging in ASP.NET Core
If I activate logging in .Net 7.0, the info is written to the standard logger for each request and response.
Is is also possible to write the info with nlog, SerialLogger...., this is good and ok.
However, it is not possible to assign the response to the request because there is no unique ID here.
Also i don't find any key to assign respnose and the response-body ?
Yhy not, is it not possible or does this contradict an architecture guideline?
My idea was, write a uniuqe id (guid) to every related request/response/body, such a UniueConnectionId or other named.
Describe the solution you'd like
Output-Example of a Request with the HttpLoggingMiddleware
info: Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware[1]
Request:
Protocol: HTTP/1.1
Method: POST
Scheme: http
UniqueConnectionId: 55b51106-0cc2-4086-81db-de8cadf91cdc => NEW
....
Example of a Request-Body
info: Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware[2]
RequestBody: {
"username": "josef",
"password": "MyPassword",
UniqueConnectionId: 55b51106-0cc2-4086-81db-de8cadf91cdc => NEW
}
response and response body
info: Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware[1]
Response:
StatusCode: 200
Content-Type: application/json; charset=utf-8
UniqueConnectionId: 55b51106-0cc2-4086-81db-de8cadf91cdc => NEW
info: Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware[2]
ResponseBody: {"token":"very secret token"}
UniqueConnectionId: 55b51106-0cc2-4086-81db-de8cadf91cdc => NEW
Additional context
No response