I am running a rails 3.2 app in Heroku Cedar stack.
When I locally execute rake tasks that involve querying the database, the screen log does not show the detail of the SQL queries.
On the other hand, when I run the same task on the Heroku deployed app (heroku run rake ...), there is a verbose output of every query executed by the rake task. I would like to disable such detail showing in the screen. Is it possible?
Thank you for your help!
You can wrap your code in a Rails.logger.silence
block:
task thing_doer: :environment do
Rails.logger.silence { ThingDoer.call }
end
I'd suggest running these tasks in detached
mode. This will prevent output in your terminal, but still have output (anything written to STDOUT
or STDERR
) to the Heroku log files.
This would be run by:
heroku run:detached rake ...
There is good documentation on this as well to help you out. Hopefully this is what you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With