From 8300234f9f79b78b78ba1cb90739c776fca8e030 Mon Sep 17 00:00:00 2001 From: Ethan Date: Thu, 18 May 2017 16:06:56 -0700 Subject: lob subscriber should only rescue StandardError, not Exception --- activesupport/lib/active_support/log_subscriber.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/log_subscriber.rb b/activesupport/lib/active_support/log_subscriber.rb index e2c4f33565..fd00b4bf83 100644 --- a/activesupport/lib/active_support/log_subscriber.rb +++ b/activesupport/lib/active_support/log_subscriber.rb @@ -81,7 +81,7 @@ module ActiveSupport def finish(name, id, payload) super if logger - rescue Exception => e + rescue => e logger.error "Could not log #{name.inspect} event. #{e.class}: #{e.message} #{e.backtrace}" end -- cgit v1.2.3 From 1c5f5af8c92286ce3f5cb03379098249432faafd Mon Sep 17 00:00:00 2001 From: Ethan Date: Thu, 18 May 2017 16:07:35 -0700 Subject: check that logger is defined in log subscriber rescue before logging --- activesupport/lib/active_support/log_subscriber.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/log_subscriber.rb b/activesupport/lib/active_support/log_subscriber.rb index fd00b4bf83..e704e18fb9 100644 --- a/activesupport/lib/active_support/log_subscriber.rb +++ b/activesupport/lib/active_support/log_subscriber.rb @@ -82,7 +82,9 @@ module ActiveSupport def finish(name, id, payload) super if logger rescue => e - logger.error "Could not log #{name.inspect} event. #{e.class}: #{e.message} #{e.backtrace}" + if logger + logger.error "Could not log #{name.inspect} event. #{e.class}: #{e.message} #{e.backtrace}" + end end private -- cgit v1.2.3