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

Log RecordNotFound as 404 #112

Merged
merged 1 commit into from Feb 7, 2015
Merged

Conversation

pxlpnk
Copy link
Collaborator

@pxlpnk pxlpnk commented Feb 7, 2015

This is an attempt/proposal to fix #110 and parts of #27.
It will correctly log an ActiveRecord::RecordNotFound as a 404 and other things coming back from AR and others.

It will however not log a ActionController::RoutingError as this is out of reach with the current implementation. See the referenced issues for this.

@benlovell
Copy link
Collaborator

👍

pxlpnk added a commit that referenced this pull request Feb 7, 2015
@pxlpnk pxlpnk merged commit a14ca70 into roidrage:master Feb 7, 2015
@pxlpnk pxlpnk deleted the fix/404-handling branch February 7, 2015 19:21
@jturkel
Copy link

jturkel commented May 11, 2015

@pxlpnk - Any plans to release a new version of the gem with this fix?

@benlovell
Copy link
Collaborator

@jturkel I'll cut a release. Watch this space.

@kitop
Copy link

kitop commented Jun 30, 2015

Is there a way to do the same for ActionController::RoutingError?

@benlovell
Copy link
Collaborator

@kitop Did you try the latest release? It should have been resolved by #134

@kitop
Copy link

kitop commented Jun 30, 2015

Yes.
We're using 0.3.3, and still seeing some of those logging.

Eg:

ActionController::RoutingError (No route matches [GET] "/assets/images/wordpress.jpg"):
  actionpack (4.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  newrelic_rpm (3.12.0.288) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
  actionpack (4.2.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  newrelic_rpm (3.12.0.288) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
  lograge (0.3.3) lib/lograge/rails_ext/rack/logger.rb:15:in `call_app'
  railties (4.2.3) lib/rails/rack/logger.rb:20:in `block in call'

Any ideas why it could happen?

@pxlpnk
Copy link
Collaborator Author

pxlpnk commented Jun 30, 2015

This happens in the rack stack. lograge currently can not handle those errors.
In general rails has two (two my knowledge) kind of 404 exceptions. One being from ActiveRecord when a record is not found and the other from the routing stack that is handled in rack.

@kitop
Copy link

kitop commented Jun 30, 2015

Ah, gotcha. Thanks for the explanation @pxlpnk!!

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

Successfully merging this pull request may close these issues.

logging status 500 instead of status 404
4 participants