dotnet / dotnet/aspnetcore

W3CLogger should also log ShortCircuit requests

Open
#60,277 3 comments 0 reactions 0 assignees View on GitHub
area-networking Needs: Attention :wave: Needs: Repro
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

As suggested by the official documentation, I have shortcircuited requests to robots.txt and others in my application. I noticed that these short-circuited requests are not logged by the W3CLogger (which I more or less expect, as it is injected as middleware).
I did notice however, that when the file is served as a static file, it is being logged by the W3CLogger, however for some of these requests I want to generate the contents dynamically and in that case they won't show up in the W3C log.

### Describe the solution you'd like

I see three different solutions from a point of view of a **user** of ASP.NET Core:

- Allow for a way to insert middleware before the routing middleware (i.e. before any short-circuiting is handled). That way the W3CLogger could be inserted before the routing middleware and all requests will be logged.
- Have a configuration option to indicate whether ShortCircuit requests should be logged by the W3CLogger
- Make W3CLogger log all requests always, even ShortCircuit requests.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.