Skip to content

Commit f7905e7

Browse files
authored
Revert "Respect action_dispatch.log_rescued_responses"
1 parent 903ef1b commit f7905e7

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

lib/rails_semantic_logger/extensions/action_dispatch/debug_exceptions.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ class DebugExceptions
77

88
undef_method :log_error
99
if (Rails::VERSION::MAJOR == 7 && Rails::VERSION::MINOR >= 1) || Rails::VERSION::MAJOR > 7
10-
def log_error(request, wrapper)
10+
def log_error(_request, wrapper)
1111
Rails.application.deprecators.silence do
12-
return if !log_rescued_responses?(request) && wrapper.rescue_response?
13-
14-
level = request.get_header("action_dispatch.debug_exception_log_level")
12+
level = wrapper.respond_to?(:rescue_response?) && wrapper.rescue_response? ? :debug : :fatal
1513
ActionController::Base.logger.log(level, wrapper.exception)
1614
end
1715
end

test/controllers/articles_controller_test.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -141,26 +141,6 @@ class ArticlesControllerTest < ActionDispatch::IntegrationTest
141141
assert_equal 4, messages.count, messages
142142
assert_kind_of ActiveRecord::RecordNotFound, messages[3].exception
143143
end
144-
145-
it "raises and does not log exception when action_dispatch.log_rescued_responses is false" do
146-
# we're testing ActionDispatch::DebugExceptions here too
147-
messages = semantic_logger_events do
148-
old_show = Rails.application.env_config["action_dispatch.show_exceptions"]
149-
old_log_rescued_responses = Rails.application.env_config["action_dispatch.log_rescued_responses"]
150-
151-
begin
152-
Rails.application.env_config["action_dispatch.show_exceptions"] = :all
153-
Rails.application.env_config["action_dispatch.log_rescued_responses"] = false
154-
get article_url(:show)
155-
rescue ActiveRecord::RecordNotFound => e
156-
# expected
157-
ensure
158-
Rails.application.env_config["action_dispatch.show_exceptions"] = old_show
159-
Rails.application.env_config["action_dispatch.log_rescued_responses"] = old_log_rescued_responses
160-
end
161-
end
162-
assert_equal 3, messages.count, messages
163-
end
164144
end
165145
end
166146
end

0 commit comments

Comments
 (0)