Skip to content

Commit fb9bd70

Browse files
authored
Merge pull request reidmorrison#179 from umbrellio/update-log-error
Fix log level for exceptions rescued by Rails
2 parents f8f1084 + aaaf46a commit fb9bd70

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/rails_semantic_logger/extensions/action_dispatch/debug_exceptions.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ class DebugExceptions
99
if (Rails::VERSION::MAJOR == 7 && Rails::VERSION::MINOR >= 1) || Rails::VERSION::MAJOR > 7
1010
def log_error(_request, wrapper)
1111
Rails.application.deprecators.silence do
12-
ActionController::Base.logger.fatal(wrapper.exception)
12+
level = wrapper.respond_to?(:rescue_response?) && wrapper.rescue_response? ? :debug : :fatal
13+
ActionController::Base.logger.log(level, wrapper.exception)
1314
end
1415
end
1516
else
1617
def log_error(_request, wrapper)
1718
ActiveSupport::Deprecation.silence do
18-
ActionController::Base.logger.fatal(wrapper.exception)
19+
level = wrapper.respond_to?(:rescue_response?) && wrapper.rescue_response? ? :debug : :fatal
20+
ActionController::Base.logger.log(level, wrapper.exception)
1921
end
2022
end
2123
end

0 commit comments

Comments
 (0)