From Heroku | Dev Center | Logging:
When a Rails app is pushed, we will automatically install the rails_log_stdout plugin into the application which will redirect logs to stdout
.
I think Heroku includes (in the output sent through your git push
command) a notification about this (and one other addition: for serving static/public
content, if I remember correctly). You may only see the notifications for certain kinds of pushes though (complete slug rebuilds?). I remember seeing it when I recently pushed a new application to a Bamboo/MRI-1.9.2 stack, but I do not think I got the message every time I pushed changes to just the application’s code (maybe adding a new gem to the Gemfile is enough to trigger it?).
Several Rails subsystems keep their own logger
binding (independent bindings whose values are often initialized from Rails.logger
; reassigning the latter does not change the former):
Heroku’s changes probably set a new value for Rails.logger
before ActiveRecord
is initialized. When ActiveRecord
is eventually loaded, it sets its own logger
to be the same as Rails.logger
(the Heroku/stdout one). When your task runs, it reassigns Rails.logger
, but it is too late for this to have any effect on ActiveRecord::Base.logger
(the only most likely to be handling the SQL logs).
You probably need to reassign some of these other logger
bindings to squelch the logging going to STDOUT. Some other likely locations are listed in rails_log_stdout’s init.rb
in the Rails 2 section.