Sha256: 718da65db7d3ae0d62369228a2c0b6f50fc3341e4d309332d5230d7038f97e55

Contents?: true

Size: 1.47 KB

Versions: 10

Compression:

Stored size: 1.47 KB

Contents

Capistrano::Configuration.instance(:must_exist).load do
  
  namespace :slice do
    
    desc "Tail the Rails log for this environment"
    task :tail_logs, :roles => :app do
      run "tail -f #{shared_path}/log/#{rails_env}.log" do |channel, stream, data|
        puts # for an extra line break before the host name
        puts "#{channel[:server]} -> #{data}"
        break if stream == :err
      end
    end
    
    desc "Tail the system log for this environment"
    task :tail_syslog, :roles => :app do
      sudo "tail -f /var/log/syslog" do |channel, stream, data|
        puts # for an extra line break before the host name
        puts "#{channel[:server]} -> #{data}"
        break if stream == :err
      end
    end
    
    desc "Tail the message log for this environment"
    task :tail_messages, :roles => :app do
      sudo "tail -f /var/log/messages" do |channel, stream, data|
        puts # for an extra line break before the host name
        puts "#{channel[:server]} -> #{data}"
        break if stream == :err
      end
    end
    
    desc <<-DESC
    grep the production.log to find long running queries
    DESC
    task :grep_requests, :roles => :app do
      run "grep 'Completed in [0-9]*' #{shared_path}/log/#{rails_env}.log"
    end

    desc <<-DESC
    grep the production.log to find long running queries
    DESC
    task :grep_long_requests, :roles => :app do
      run "grep 'Completed in [0-9][0-9]' #{shared_path}/log/#{rails_env}.log"
    end
    
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fdlcap-0.4.17 lib/fdlcap/recipes/slice.rb
fdlcap-0.4.15 lib/fdlcap/recipes/slice.rb
fdlcap-0.4.14 lib/fdlcap/recipes/slice.rb
fdlcap-0.4.13 lib/fdlcap/recipes/slice.rb
fdlcap-0.4.12 lib/fdlcap/recipes/slice.rb
fdlcap-0.4.11 lib/fdlcap/recipes/slice.rb
fdlcap-0.4.10 lib/fdlcap/recipes/slice.rb
fdlcap-0.4.9 lib/fdlcap/recipes/slice.rb
fdlcap-0.4.7 lib/fdlcap/recipes/slice.rb
fdlcap-0.4.6 lib/fdlcap/recipes/slice.rb