Closed kendaleiv closed 2 years ago
Its not lost! its among the top asks in uservoice! Unfortunately, this is not going to be supported by the ApplicationInsights SDK in this year.
The current suggestion/workaround is for customers to write the RequestBody using Ilogger. And have application insights capture the ilogger trace. Since ilogger traces gets automatically correlated with Request telemetry, it should be possible to find the body.
Hi @cijothomas! do you happen to have a sample for the item above, i have an mvc project in 4.6 that i want to be able to log the request and response to app insights and not sure what approach to take based on the comment here.
Regards
@leninc The recommendation currently is: Get request/response body - log it using ilogger instance. Configure application insights to capture it - if the ilogger is logged at Warning level or above, the Application Insights collects it by default. Else modify filters to capture it. (https://docs.microsoft.com/en-us/azure/azure-monitor/app/ilogger#control-logging-level)
I don't have working sample to correctly capture request/response body. For logging with Ilogger, the official docs has examples.
@cijothomas thanks for the quick response, will look into this
This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 7 days.
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-logging/?view=aspnetcore-6.0 .New middleware from asp.net core 6.0 makes this easy to do.
@cijothomas I activated the new HttpLogging middleware, can see the output from it in my console window, however it is not visible/attached to my App Insights. What am I missing?
Previously reported here: https://github.com/microsoft/ApplicationInsights-aspnetcore/issues/686
Sounds like it may be happening per https://github.com/microsoft/ApplicationInsights-aspnetcore/issues/686#issuecomment-545531512 but didn't want it to fall off the radar for those who would find it useful.