Building on @qarol but even cooler, add this Rake task to one of your Rake files:
task :log => :environment do
ActiveRecord::Base.logger = Logger.new(STDOUT)
end
Then you can call ANY Rake task and have the output logged:
rake log db:migrate
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…