bdunagan

fill the void - bdunagan

08 Oct 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
Previous LinkedIn Twitter GitHub Email Next