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

Make the log level in DebugExceptions configurable #48575

Merged
merged 2 commits into from Jun 27, 2023

Conversation

skipkayhil
Copy link
Member

Motivation / Background

Fixes #47643

This middleware has been logging at a FATAL level since the first commit in Rails (the code originally lived in actionpack/lib/action_controller/rescue.rb). However, FATAL is documented in the Ruby Logger docs as being for "An unhandleable error that results in a program crash.", which does not really apply to this case since DebugExceptions is handling the error. A more appropriate level would be ERROR, which the Ruby Logger docs describe as "A handleable error condition."

Detail

This commit introduces a new configuration for the DebugExceptions log level so that new apps will have it set to ERROR by default and ERROR can eventually be made the default.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

This middleware has been logging at a FATAL level since the first
[commit][1] in Rails (the code originally lived in
actionpack/lib/action_controller/rescue.rb). However, FATAL is
documented in the Ruby Logger [docs][2] as being for "An unhandleable
error that results in a program crash.", which does not really apply to
this case since DebugExceptions is handling the error. A more
appropriate level would be ERROR, which the Ruby Logger docs describe as
"A handleable error condition."

This commit introduces a new configuration for the DebugExceptions log
level so that new apps will have it set to ERROR by default and ERROR
can eventually be made the default.

[1]: db045db
[2]: https://ruby-doc.org/3.2.1/stdlibs/logger/Logger/Severity.html
@guilleiguaran guilleiguaran merged commit 1c0aeed into rails:main Jun 27, 2023
8 of 9 checks passed
@skipkayhil skipkayhil deleted the hm-config-exception-level branch June 27, 2023 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uncaught request-level errors should be logged as :error, not :fatal
3 participants