logging - Rails 4 log all not found requests to the application -
what want output without error log file requests cause 404 ? or log such requests separately ?
you'll best hooking config.exceptions_app
middleware hook:
sets exceptions application invoked showexception middleware when exception happens. defaults actiondispatch::publicexceptions.new(rails.public_path).
--
exceptions_app
having written gem this, , there nice demonstrations of how can used effectively, i'd recommend doing this:
#config/application.rb config.exceptions_app = ->(env) { applicationcontroller.action(:exception).call(env) } #app/controllers/application_controller.rb class applicationcontroller < actioncontroller::base def exception # code here end end
i'm not sure how you'd make conditional (i.e capturing "not found" exception), above starting point sure!
Comments
Post a Comment