{"action":"created","issue":{"url":"https://api.github.com/repos/yuki24/rambulance/issues/16","labels_url":"https://api.github.com/repos/yuki24/rambulance/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/yuki24/rambulance/issues/16/comments","events_url":"https://api.github.com/repos/yuki24/rambulance/issues/16/events","html_url":"https://github.com/yuki24/rambulance/issues/16","id":54674935,"number":16,"title":"Any way to suppress Rails FATAL logging when handled by rambulance? ","user":{"login":"gingerlime","id":524274,"avatar_url":"https://avatars.githubusercontent.com/u/524274?v=3","gravatar_id":"","url":"https://api.github.com/users/gingerlime","html_url":"https://github.com/gingerlime","followers_url":"https://api.github.com/users/gingerlime/followers","following_url":"https://api.github.com/users/gingerlime/following{/other_user}","gists_url":"https://api.github.com/users/gingerlime/gists{/gist_id}","starred_url":"https://api.github.com/users/gingerlime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gingerlime/subscriptions","organizations_url":"https://api.github.com/users/gingerlime/orgs","repos_url":"https://api.github.com/users/gingerlime/repos","events_url":"https://api.github.com/users/gingerlime/events{/privacy}","received_events_url":"https://api.github.com/users/gingerlime/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-01-17T20:56:37Z","updated_at":"2015-06-03T08:28:25Z","closed_at":"2015-03-29T06:03:36Z","body":"Hi @yuki24,\r\n\r\nThanks for creating this gem. I'm testing it out, and it looks really nice and seems to work well.\r\n\r\nMy question is with the following example / scenario:\r\n\r\nThe following curl command:\r\n`curl -D - -X PUT --data \"not json\" -H \"Content-Type: application/json\" http://localhost:3000`\r\n\r\nwould generate a `ActionDispatch::ParamsParser::ParseError`.\r\n\r\nWhen I configure rambulance like this, it works great and returns a 400 as expected.\r\n```ruby\r\nconfig.rescue_responses = {\r\n  'ActionDispatch::ParamsParser::ParseError' => :bad_request,\r\n  ...\r\n}\r\n```\r\n\r\nSo far so good. One thing that I noticed however, even when requests are caught and handled correctly by rambulance, rails still logs a `FATAL` message, which gets emailed automatically on production. It's great to get an email for something that wasn't handled, but when it *is* handled by rambulance, then I wonder if there's a way to suppress this error from being logged and prevent an email from being sent out?\r\n\r\n(I know it's probably not strictly an issue with rambulance, but I would appreciate your help / thoughts about this)"},"comment":{"url":"https://api.github.com/repos/yuki24/rambulance/issues/comments/108245998","html_url":"https://github.com/yuki24/rambulance/issues/16#issuecomment-108245998","issue_url":"https://api.github.com/repos/yuki24/rambulance/issues/16","id":108245998,"user":{"login":"gingerlime","id":524274,"avatar_url":"https://avatars.githubusercontent.com/u/524274?v=3","gravatar_id":"","url":"https://api.github.com/users/gingerlime","html_url":"https://github.com/gingerlime","followers_url":"https://api.github.com/users/gingerlime/followers","following_url":"https://api.github.com/users/gingerlime/following{/other_user}","gists_url":"https://api.github.com/users/gingerlime/gists{/gist_id}","starred_url":"https://api.github.com/users/gingerlime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gingerlime/subscriptions","organizations_url":"https://api.github.com/users/gingerlime/orgs","repos_url":"https://api.github.com/users/gingerlime/repos","events_url":"https://api.github.com/users/gingerlime/events{/privacy}","received_events_url":"https://api.github.com/users/gingerlime/received_events","type":"User","site_admin":false},"created_at":"2015-06-03T08:28:25Z","updated_at":"2015-06-03T08:28:25Z","body":"Hey @dnajd, I ended up using this snippet for lograge to reduce noise. It feels a bit hacky, but seems to work\r\n\r\n```ruby\r\n# config/environments/production.rb\r\n  config.lograge.ignore_custom = lambda do |event|\r\n    # the ExceptionsApp (Rambulance) handles all errors. Errors raised by other\r\n    # controllers can be ignored by lograge until they reach the exceptions app.\r\n    payload = event.payload\r\n    if payload[:exception].present? && payload[:controller] != 'ExceptionsApp'\r\n      return true\r\n    end\r\n    false\r\n  end\r\n```\r\n\r\nI still think it would be better if rambulance hooked both into the middleware stack (for exceptions outside the rails app), and around rails itself (e.g. rescue from application controller). It will save unnecessary roundtrips through the middleware stack for local errors and play nicely with any other middleware that assumes errors are handled by the application rather than \"let loose\". Unfortunately I don't think I have the rails chops to figure out how to make this happen (or the time to dig into this).\r\n\r\nHope my workaround is helpful though, at least for lograge."}}