bdunagan

Brian Dunagan

October 8 2011
Rails Tip: Logger in Rake

Here are a couple lines of Ruby to bring Logger into rake tasks. I use them for logging cron jobs that are Rails rake tasks. I tried this post, but it didn’t get me all the way.

# Used with Rails 2.3.4
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
RAILS_DEFAULT_LOGGER.level = Logger::INFO
def logger
  Rails.logger
end
Rack Tip: ActiveRecord with Logging Logging slow queries in MySQL
LinkedIn GitHub Email