You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Request lines for an app's error pages log the error page's path, and some errors log two request lines #28
With config.exceptions_app = routes (an app's own error pages, such as an ErrorsController), Rails' ShowExceptions renders the error page by sending the request through the routes again as GET /<status>. The error page's controller then logs a request line of its own:
An error raised inside a controller action logs two request lines: the action's (its method and path, the error's status) and the error page's (GET /500, GET /422).
An error raised before the action's line is logged logs only the error page's line, with the wrong method and path. For example, ActionController::BadRequest for a query Rack can't parse is raised while Rails builds the action's instrumentation payload, so the only line is GET /400 instead of the request's own method and path.
Rails keeps the original method and path in the request's action_dispatch.original_request_method and action_dispatch.original_path headers.
LogStruct should:
log the error page's line with the original method and path, and
log one request line per request: skip the error page's line when the failed action already logged one.
To reproduce: a Rails app with config.exceptions_app = routes, match "/500", to: "errors#internal_server_error", via: :all, and an action that raises, requested with action_dispatch.show_exceptions on. The log has the action's line and a second GET /500 line.
Fixed in 0.2.1 (changelog, #43). With config.exceptions_app = routes, a request whose action raises has one request line, the action's: the error page's controller no longer logs a second GET /500 line. When the error comes before any action (a routing error) or after it (in a middleware), the error page's line is logged with the request's own method and path, from action_dispatch.original_request_method and action_dispatch.original_path.
Activity
ndbroadbent commentedon Oct 18, 2026
Fixed in 0.2.1 (changelog, #43). With
config.exceptions_app = routes, a request whose action raises has one request line, the action's: the error page's controller no longer logs a secondGET /500line. When the error comes before any action (a routing error) or after it (in a middleware), the error page's line is logged with the request's own method and path, fromaction_dispatch.original_request_methodandaction_dispatch.original_path.