Permalink
Browse files

Add host information to more logging places.

Capistrano outputs all logs into a single place which makes it rather difficult
to figure out what has happened on a single host machine, especially when you are
running parallel. By adding host information to the log as possible as it can will
enable tools such as splunk to easily filter out host specific log information, which
is helpful during the later auditing process.
  • Loading branch information...
1 parent 04d5da4 commit 0988ebd36245184d33fda59fb2530c5c0839b121 @exceedhl committed Dec 15, 2011
Showing with 5 additions and 3 deletions.
  1. +2 −0 lib/capistrano/command.rb
  2. +3 −3 lib/capistrano/transfer.rb
@@ -219,6 +219,8 @@ def open_channels
command_line = [environment, shell, cmd].compact.join(" ")
ch[:command] = command_line
+ logger.trace command_line, ch[:server] if logger
+
ch.exec(command_line)
ch.send_data(options[:data]) if options[:data]
else
@@ -117,7 +117,7 @@ def prepare_transfers
def prepare_scp_transfer(from, to, session)
real_callback = callback || Proc.new do |channel, name, sent, total|
- logger.trace "[#{channel[:host]}] #{name}" if logger && sent == 0
+ logger.trace "#{transport} #{operation} #{from} -> #{to}", channel[:host] if logger && sent == 0
end
channel = case direction
@@ -167,9 +167,9 @@ def prepare_sftp_transfer(from, to, session)
if callback
callback.call(event, op, *args)
elsif event == :open
- logger.trace "[#{op[:host]}] #{args[0].remote}"
+ logger.trace "#{transport} #{operation} #{from} -> #{to}", op[:host]
elsif event == :finish
- logger.trace "[#{op[:host]}] done"
+ logger.trace "#{transport} #{operation} #{from} -> #{to} done", op[:host]
end
end

0 comments on commit 0988ebd

Please sign in to comment.