aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorGannon McGibbon <gannon.mcgibbon@gmail.com>2019-07-12 19:02:12 -0400
committerGannon McGibbon <gannon.mcgibbon@gmail.com>2019-07-15 11:36:31 -0400
commit171965810e05ffb8221c9c4d26c28c42a43ccd22 (patch)
treec39d5d02bcfd64cc6bf5250e64a298138a3029d7 /activesupport/lib
parent88b91299f3fc5b912e10323ed0ad18c87c7584e5 (diff)
downloadrails-171965810e05ffb8221c9c4d26c28c42a43ccd22.tar.gz
rails-171965810e05ffb8221c9c4d26c28c42a43ccd22.tar.bz2
rails-171965810e05ffb8221c9c4d26c28c42a43ccd22.zip
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]
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/log_subscriber.rb3
1 files changed, 3 insertions, 0 deletions
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
# <tt>ActiveRecord::LogSubscriber</tt> definition.
#
+ # A logger also needs to be set with <tt>ActiveRecord::LogSubscriber.logger=</tt>.
+ # This is assigned automatically in a Rails environment.
+ #
# After configured, whenever a <tt>"sql.active_record"</tt> notification is published,
# it will properly dispatch the event
# (<tt>ActiveSupport::Notifications::Event</tt>) to the sql method.