title: Tail production log with Capistrano - how to stop it
body: <p>I found this nifty code snippet on several sites, allowing me to analyze the production log via Capistrano:</p>
  
  <pre><code>desc "tail production log files" 
  task :tail_logs, :roles => :app do
    run "tail -f #{shared_path}/log/production.log" do |channel, stream, data|
      puts  # for an extra line break before the host name
      puts "#{channel[:host]}: #{data}" 
      break if stream == :err    
    end
  end</code></pre>
  
  <p>It works perfectly well, however, when I'm finished reading the logs, I hit Ctrl+C and it produces a nasty error on my console. Not that this is a huge problem, but I find it annoying. What can I do so that no error is produced, but the task/tail/log viewing just quietly ends?</p>
  
  <p>Also, I'm not that familiar with how to analyze logs - is this really the best way to just have a quick look at the most recent events in your (remote production) log, or is there a better way? I know there are a gazillion tools for log analysis, but I want a dead-simple solution to see the last couple requests, not something bulky and complicated. I'm not sure if this Capistrano solution is really optimal though. Like, what's the solution most people use?</p>