Permalink
Browse files

Revert "Only lookup `config.log_level` for stdlib `::Logger`. Closes #…

…11665."

This reverts commit e0a521c.

Conflicts:
	railties/CHANGELOG.md

We expect loggers to quack like stdlib logger. If log4r needs different
level= assignment, using a Logger-quacking wrapper is the way to do it.

Fixes #14114.
  • Loading branch information...
guilleiguaran committed Feb 21, 2014
1 parent c93c558 commit b1867c85fa934caad1cd7410e1bd9bc0463a2f42
@@ -25,13 +25,6 @@
*Cristian Mircea Messel*, *Chulki Lee*
* Only lookup `config.log_level` for stdlib `::Logger` instances.
Assign it as is for third party loggers like `Log4r::Logger`.
Fixes #13421.
*Yves Senn*
* The `Gemfile` of new applications depends on SDoc ~> 0.4.0.
*Xavier Noria*
@@ -53,11 +53,7 @@ module Bootstrap
logger
end
if ::Logger === Rails.logger
Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
else
Rails.logger.level = config.log_level
end
Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
end
# Initialize cache early in the stack so railties can make use of it.
@@ -762,27 +762,14 @@ def index
end
end
test "lookup config.log_level with custom logger (stdlib Logger)" do
test "config.log_level with custom logger" do
make_basic_app do |app|
app.config.logger = Logger.new(STDOUT)
app.config.log_level = :info
end
assert_equal Logger::INFO, Rails.logger.level
end
test "assign log_level as is with custom logger (third party logger)" do
logger_class = Class.new do
attr_accessor :level
end
logger_instance = logger_class.new
make_basic_app do |app|
app.config.logger = logger_instance
app.config.log_level = :info
end
assert_equal logger_instance, Rails.logger
assert_equal :info, Rails.logger.level
end
test "respond_to? accepts include_private" do
make_basic_app

0 comments on commit b1867c8

Please sign in to comment.