mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Rails.logger should have level specified by config.log_level.
Fix bug when log level of Rails.logger (which was set via config.logger) does not match the config.log_level.
This commit is contained in:
parent
77cf5cfc74
commit
e2180e84a9
2 changed files with 10 additions and 1 deletions
|
@ -42,7 +42,6 @@ INFO
|
|||
logger = ActiveSupport::Logger.new f
|
||||
logger.formatter = config.log_formatter
|
||||
logger = ActiveSupport::TaggedLogging.new(logger)
|
||||
logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
|
||||
logger
|
||||
rescue StandardError
|
||||
logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDERR))
|
||||
|
@ -53,6 +52,8 @@ INFO
|
|||
)
|
||||
logger
|
||||
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.
|
||||
|
|
|
@ -671,5 +671,13 @@ module ApplicationTests
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue