diff options
-rw-r--r-- | actionpack/lib/action_controller/failsafe.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 6 | ||||
-rw-r--r-- | activesupport/lib/active_support/deprecation.rb | 2 | ||||
-rw-r--r-- | railties/lib/commands/runner.rb | 4 |
4 files changed, 9 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/failsafe.rb b/actionpack/lib/action_controller/failsafe.rb index bb6ef39470..1cd649b2e1 100644 --- a/actionpack/lib/action_controller/failsafe.rb +++ b/actionpack/lib/action_controller/failsafe.rb @@ -42,8 +42,8 @@ module ActionController end def failsafe_logger - if defined?(::RAILS_DEFAULT_LOGGER) && !::RAILS_DEFAULT_LOGGER.nil? - ::RAILS_DEFAULT_LOGGER + if defined? Rails && Rails.logger + Rails.logger else Logger.new($stderr) end diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 293450c180..23b7aee514 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -559,9 +559,9 @@ module ActiveSupport #:nodoc: # Old style environment.rb referenced this method directly. Please note, it doesn't # actually *do* anything any more. def self.root(*args) - if defined?(RAILS_DEFAULT_LOGGER) - RAILS_DEFAULT_LOGGER.warn "Your environment.rb uses the old syntax, it may not continue to work in future releases." - RAILS_DEFAULT_LOGGER.warn "For upgrade instructions please see: http://manuals.rubyonrails.com/read/book/19" + if defined? Rails && Rails.logger + Rails.logger.warn "Your environment.rb uses the old syntax, it may not continue to work in future releases." + Rails.logger.warn "For upgrade instructions please see: http://manuals.rubyonrails.com/read/book/19" end end end diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb index 543e3b08d2..f18ea197a5 100644 --- a/activesupport/lib/active_support/deprecation.rb +++ b/activesupport/lib/active_support/deprecation.rb @@ -13,7 +13,7 @@ module ActiveSupport $stderr.puts callstack.join("\n ") if debug }, 'development' => Proc.new { |message, callstack| - logger = defined?(::RAILS_DEFAULT_LOGGER) ? ::RAILS_DEFAULT_LOGGER : Logger.new($stderr) + logger = defined? Rails ? Rails.logger : Logger.new($stderr) logger.warn message logger.debug callstack.join("\n ") if debug } diff --git a/railties/lib/commands/runner.rb b/railties/lib/commands/runner.rb index 2411c3d270..510128318a 100644 --- a/railties/lib/commands/runner.rb +++ b/railties/lib/commands/runner.rb @@ -48,5 +48,7 @@ begin eval(code_or_file) end ensure - RAILS_DEFAULT_LOGGER.flush if RAILS_DEFAULT_LOGGER + if defined? Rails + Rails.logger.flush if Rails.logger.respond_to?(:flush) + end end |