mirror of
https://github.com/github/rails.git
synced 2026-01-13 00:28:26 -05:00
Prefer Rails.logger over RAILS_DEFAULT_LOGGER
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user