Revert "Only lookup `config.log_level` for stdlib `::Logger`. Closes #11665."
This reverts commit e0a521cfcd
.
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.
This commit is contained in:
parent
c93c558aa8
commit
b1867c85fa
|
@ -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 @@ INFO
|
|||
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,7 +762,7 @@ module ApplicationTests
|
|||
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
|
||||
|
@ -770,19 +770,6 @@ module ApplicationTests
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue