Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A file not found should not be a Warning log #336

Open
Masterjun3 opened this issue Feb 23, 2025 · 0 comments
Open

A file not found should not be a Warning log #336

Masterjun3 opened this issue Feb 23, 2025 · 0 comments

Comments

@Masterjun3
Copy link

Compare the WebOptimizer file not found log with the ASP.NET Core file not found log.
WebOptimizer logs it as Warning:

https://github.com/puhnastik/WebOptimizer/blob/a1cb720241120cb569abaa6d49475b87dde0f75a/src/WebOptimizer.Core/Extensions/LoggerExtensions.cs#L28-L31

Where ASP.NET Core's UseStaticFiles logs a file not found as a Debug log. Which makes more sense.

https://github.com/dotnet/aspnetcore/blob/cd5ca6985645aa4929747bd690109a99a97126e3/src/Middleware/StaticFiles/src/LoggerExtensions.cs#L38-L39


Microsoft explains Warnings like this:

For abnormal or unexpected events. Typically includes errors or conditions that don't cause the app to fail.

However, site requests are inherently user data, so it should be expected some would access paths of files that do not exist. Often potential paths are crawled automatically in search of exploits. Causing a Warning log for each of those does not make sense.
In fact, the original issue #102 that eventually caused PR #173 to implement this file not found log even mentions crawlers:

a reasonably high-traffic website that was frequently polled (by search engine crawlers, presumably) for static files from earlier versions of the site that no longer exist.

Warnings should not be used for these expected events. I suggest an Information log, like all the others in this file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant