lib/chef/application.rb in chef-0.10.0.beta.5 vs lib/chef/application.rb in chef-0.10.0.beta.6

- old
+ new

@@ -17,10 +17,11 @@ require 'chef/config' require 'chef/exceptions' require 'chef/log' require 'mixlib/cli' +require 'tmpdir' class Chef::Application include Mixlib::CLI def initialize @@ -119,12 +120,23 @@ Chef::Config.merge!(config) end class << self + def debug_stacktrace(e) + message = "#{e.class}: #{e}\n#{e.backtrace.join("\n")}" + filename = File.join(Dir.tmpdir, "chef-stacktrace.out") + Chef::Log.fatal("Stacktrace dumped to #{filename}") + Chef::Log.debug(message) + chef_stacktrace_out = File.open(filename, "w") + chef_stacktrace_out.puts "Generated at #{Time.now.to_s}" + chef_stacktrace_out.puts message + chef_stacktrace_out.close + true + end + # Log a fatal error message to both STDERR and the Logger, exit the application def fatal!(msg, err = -1) - STDERR.puts("FATAL: #{msg}") Chef::Log.fatal(msg) Process.exit err end def exit!(msg, err = -1)