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 808e7f0 commit e76ac3d3455f40b985b9186432a956b7e7565159 @exceedhl exceedhl committed with leehambley 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

2 comments on commit e76ac3d

Contributor

eric replied Mar 10, 2012

I'm really not a fan of this change. It makes the logs way too verbose.

Owner

leehambley replied Mar 10, 2012

@eric see my comment on the issue, we'll find a resolution in the next day or two

Please sign in to comment.