-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
API Docs to Existing Functionality
https://rocket.rs/guide/v0.5/requests/#error-catchers
Problems with Existing Functionality
Currently, rocket logs a message at level ERROR
whenever no route matches:
2025-06-30T17:05:42.542694Z ERROR rocket::server::_: No matching routes for ESC[32mGETESC[0m ESC[34m/.idea/workspace.xmlESC[0m.
2025-06-30T17:05:42.542766Z WARN rocket::server::_: No ESC[1;34m404ESC[0m catcher registered. Using Rocket default.
Or with a default error catcher installed:
2025-07-23T13:33:49.967921Z ERROR rocket::server::_: No matching routes for GET /no-such-document.
2025-07-23T13:33:49.968089Z WARN rocket::server::_: Responding with registered (error_handler) default catcher.
For a webserver facing the public internet, probes for nonexistent paths are normal. They should not generate high-severity log messages.
This is operationally important, because the webserver's ERROR, WARN and INFO logs will otherwise be swamped with useless information. On systems with space-based log rotation, this can cause important messages about actual misconfigurations to be quickly lost; on systems with time-based log rotation, it could fill up the disk and break the service.
This definitely applies to 404 errors but it may apply to others too.
Suggested Changes
I suggest the following changes:
- The "No matching routes" message ought to be at level
DEBUG
orTRACE
. - The "Responding with registered ... default catcher" message should be at leavel
TRACE
. The error catcher can log at a higher severity if it wishes.
Alternatives Considered
My application could try to install a default route but it ought to apply to all methods but there is no way to make an "all-methods" route (#2731). And this issue doesn't seem application-specific.
Additional Context
I didn't find any documentation about what happens when no route matches.
System Checks
-
I do not believe that this suggestion can or should be implemented outside of Rocket.
-
I was unable to find a previous suggestion for this change.