Skip to content
Browse files

Prefer Rails.logger over RAILS_DEFAULT_LOGGER

  • Loading branch information...
1 parent 455c7f9 commit 75fa82418d54b36b6092767f2a2b5c1d5324441b @josh josh committed Dec 10, 2008
View
4 actionpack/lib/action_controller/failsafe.rb
@@ -42,8 +42,8 @@ def log_failsafe_exception(exception)
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
View
6 activesupport/lib/active_support/dependencies.rb
@@ -559,9 +559,9 @@ class LoadingModule #: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
View
2 activesupport/lib/active_support/deprecation.rb
@@ -13,7 +13,7 @@ module Deprecation #:nodoc:
$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
}
View
4 railties/lib/commands/runner.rb
@@ -48,5 +48,7 @@
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

0 comments on commit 75fa824

Please sign in to comment.
Something went wrong with that request. Please try again.