mirror of
https://github.com/github/rails.git
synced 2026-01-24 13:58:12 -05:00
Prefer Rails.logger over RAILS_DEFAULT_LOGGER
This commit is contained in:
@@ -42,8 +42,8 @@ module ActionController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def failsafe_logger
|
def failsafe_logger
|
||||||
if defined?(::RAILS_DEFAULT_LOGGER) && !::RAILS_DEFAULT_LOGGER.nil?
|
if defined? Rails && Rails.logger
|
||||||
::RAILS_DEFAULT_LOGGER
|
Rails.logger
|
||||||
else
|
else
|
||||||
Logger.new($stderr)
|
Logger.new($stderr)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -559,9 +559,9 @@ module ActiveSupport #:nodoc:
|
|||||||
# Old style environment.rb referenced this method directly. Please note, it doesn't
|
# Old style environment.rb referenced this method directly. Please note, it doesn't
|
||||||
# actually *do* anything any more.
|
# actually *do* anything any more.
|
||||||
def self.root(*args)
|
def self.root(*args)
|
||||||
if defined?(RAILS_DEFAULT_LOGGER)
|
if defined? Rails && Rails.logger
|
||||||
RAILS_DEFAULT_LOGGER.warn "Your environment.rb uses the old syntax, it may not continue to work in future releases."
|
Rails.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"
|
Rails.logger.warn "For upgrade instructions please see: http://manuals.rubyonrails.com/read/book/19"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ module ActiveSupport
|
|||||||
$stderr.puts callstack.join("\n ") if debug
|
$stderr.puts callstack.join("\n ") if debug
|
||||||
},
|
},
|
||||||
'development' => Proc.new { |message, callstack|
|
'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.warn message
|
||||||
logger.debug callstack.join("\n ") if debug
|
logger.debug callstack.join("\n ") if debug
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,5 +48,7 @@ begin
|
|||||||
eval(code_or_file)
|
eval(code_or_file)
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
RAILS_DEFAULT_LOGGER.flush if RAILS_DEFAULT_LOGGER
|
if defined? Rails
|
||||||
|
Rails.logger.flush if Rails.logger.respond_to?(:flush)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user