[FEATURE PROPOSAL] Make ActionDispatch DebugExceptions log level configurable

Hi everyone,

First of all, thank you very much your time considering my request.

Issue

Right now all exceptions reported by ActionDispatch::DebugExceptions are logged with fatal level. As it can be seen here: https://github.com/rails/rails/blob/5a4a316246124797b1cf55b2958a388d177eb3cd/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb#L156

This affects directly the way some widely used monitoring tools report these exceptions, giving no room to fine tune the exception level. A RoutingError for example, might not be considered fatal to many teams.

Proposal

Since not all errors contained in ActionDispath::ExceptionWrapper should necessarily be considered fatal, I propose to submit a pull request which allows the development team to configure specific log levels for specific exceptions, and fallback to fatal in case no configuration exists for those.

Looking forward to hearing back from you.

Cheers!

There is already a configuration for that. config.action_dispatch.log_rescued_responses

Hi Rafael,

thank you very much for your quick response. I have been trying this today. Unless I am missing something config.action_dispatch.log_rescued_responses in conjunction with rescued_responses allows you to decide whether a exception should be logged, but does not let you decide the log level to apply in case you still want to log it, which is the point of my feature proposal.

What do you think?

@rafaelfranca may I submit a PR so that you can clearly review my proposal?

Thank you in advance.