Tailing remote logs with capistrano


I’m assuming most rails programmers today view their remote logs with a simple heroku logs. What if you don’t use heroku? If you use capistrano then just drop this into your deploy.rb

desc "tail log files"
task :tail, :roles => :app do
  run "tail -f #{shared_path}/log/#{rails_env}.log" do |channel, stream, data|
    puts "#{channel[:host]}: #{data}"
    break if stream == :err
  end
end

Then it’s just cap tail