HttpLoggingMiddleware for quick debugging
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
Some developers will only add the http logging middleware temporarily for debugging. In that case we want it to be easy to log all request fields, headers, etc. with minimal config.
The current design requires the developer to list specific header names to log unredacted. We should add a `bool DangerousSkipHeaderRedaction { get; set; }` for the quick debugging scenario.
We should also add a UseRequestLogging overload that directly accepts options so it can be enabled with a single code block sample. This also allows logging to be added to the pipeline multiple times to observe the effects middleware like UseForwardedHeaders have on the request.
```
app.UseRequestLogging(options =>
{
options.Fields = HttpLoggingOptions.AllFieldsAndHeaders;
options.DangerousSkipHeaderRedaction = true;
});
```
Here's an example from our docs that could be replaced by this:
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-5.0#troubleshoot
Contributor guide
Assessment
This issue has not been assessed yet.