lib/chef/application.rb in chef-10.12.0 vs lib/chef/application.rb in chef-10.14.0.beta.1
- old
+ new
@@ -100,12 +100,16 @@
# Initialize and configure the logger. If the configured log location is not
# STDOUT, but stdout is a TTY and we're not daemonizing, we set up a secondary
# logger with output to stdout. This way, we magically do the right thing when
# the user has configured logging to a file but they're running chef in the
# shell to debug something.
+ #
+ # If the user has configured a formatter, then we skip the magical logger to
+ # keep the output pretty.
def configure_logging
+ require 'pp'
Chef::Log.init(Chef::Config[:log_location])
- if ( Chef::Config[:log_location] != STDOUT ) && STDOUT.tty? && (!Chef::Config[:daemonize])
+ if ( Chef::Config[:log_location] != STDOUT ) && STDOUT.tty? && (!Chef::Config[:daemonize]) && (Chef::Config.formatter == "null")
stdout_logger = Logger.new(STDOUT)
STDOUT.sync = true
stdout_logger.formatter = Chef::Log.logger.formatter
Chef::Log.loggers << stdout_logger
end