Last active
June 27, 2017 17:47
-
-
Save nestorw/aa90e39334cf9dafacaacfda23f0e604 to your computer and use it in GitHub Desktop.
Capistrano Task to View Logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :logs do | |
desc "Tail logs from the given file" | |
task :tail, :file do |t, args| | |
if args[:file] | |
on roles(:app) do | |
execute "tail -f #{shared_path}/log/#{args[:file]}.log" | |
end | |
else | |
puts "please specify a logfile e.g: 'rake logs:tail[logfile]" | |
puts "will tail 'shared_path/log/logfile.log'" | |
puts "remember if you use zsh you'll need to format it as:" | |
puts "rake 'logs:tail[logfile]' (single quotes)" | |
end | |
end | |
desc "Lists available log files" | |
task :ls do |t| | |
on roles(:app) do | |
execute "ls #{shared_path}/log" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment