diff --git a/bin/vagrant b/bin/vagrant index 6999b92e0..ab8b07f66 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -3,15 +3,6 @@ require 'log4r' require 'vagrant' require 'vagrant/cli' -# Enable logging if it is requested. We do this before -# anything else so that all logs are visible. -if ENV["VAGRANT_LOG"] - logger = Log4r::Logger.new("vagrant") - logger.outputters = Log4r::Outputter.stdout - logger.level = Log4r.const_get(ENV["VAGRANT_LOG"].upcase) - logger = nil -end - # Create a logger right away logger = Log4r::Logger.new("vagrant::bin::vagrant") logger.info("`vagrant` invoked: #{ARGV.inspect}") diff --git a/lib/vagrant.rb b/lib/vagrant.rb index ed2df4eca..68612ba68 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -1,3 +1,14 @@ +# Enable logging if it is requested. We do this before +# anything else so that we can setup the output before +# any logging occurs. +if ENV["VAGRANT_LOG"] + require 'log4r' + logger = Log4r::Logger.new("vagrant") + logger.outputters = Log4r::Outputter.stdout + logger.level = Log4r.const_get(ENV["VAGRANT_LOG"].upcase) + logger = nil +end + require 'pathname' require 'json' require 'i18n'