Over a million developers have joined DZone.

Capistrano Logs

DZone's Guide to

Capistrano Logs

· ·
Free Resource
To get the last n lines from a remote log file, use this task

Usage: cap log [-s lines=100] [-s rails_env=production]
So, "cap log" returns 100 lines from production.

desc "Returns last lines of log file. Usage: cap log [-s lines=100] [-s rails_env=production]"
task :log do
  lines     = configuration.variables[:lines] || 100
  rails_env = configuration.variables[:rails_env] || 'production'
  run "tail -n #{lines} #{app_dir}/log/#{rails_env}.log" do |ch, stream, out|
    puts out


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}