From 171965810e05ffb8221c9c4d26c28c42a43ccd22 Mon Sep 17 00:00:00 2001 From: Gannon McGibbon Date: Fri, 12 Jul 2019 19:02:12 -0400 Subject: Specify log subscribers need a logger set before they can receive events The current example code for `ActiveSupport::LogSubscriber` mysteriously fails if you're using it outside of Rails. This helps clarify a logger needs to be set first before log subscribers can process events. [ci skip] --- activesupport/lib/active_support/log_subscriber.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/log_subscriber.rb b/activesupport/lib/active_support/log_subscriber.rb index db991c7a32..8b9dd1fffe 100644 --- a/activesupport/lib/active_support/log_subscriber.rb +++ b/activesupport/lib/active_support/log_subscriber.rb @@ -29,6 +29,9 @@ module ActiveSupport # subscriber, the line above should be called after your # ActiveRecord::LogSubscriber definition. # + # A logger also needs to be set with ActiveRecord::LogSubscriber.logger=. + # This is assigned automatically in a Rails environment. + # # After configured, whenever a "sql.active_record" notification is published, # it will properly dispatch the event # (ActiveSupport::Notifications::Event) to the sql method. -- cgit v1.2.3