Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #11665 from mshytikov/fix-config-log_level

Rails.logger should have level specified by config.log_level.
  • Loading branch information...
commit 067393895d5677d15cd8de938ed772f28f69dd64 2 parents 7b5a452 + af1e3b7
@rafaelfranca rafaelfranca authored
View
2  activemodel/test/cases/railtie_test.rb
@@ -8,7 +8,7 @@ def setup
require 'active_model/railtie'
# Set a fake logger to avoid creating the log directory automatically
- fake_logger = mock()
+ fake_logger = Logger.new(nil)
@app ||= Class.new(::Rails::Application) do
config.eager_load = false
View
3  railties/lib/rails/application/bootstrap.rb
@@ -42,7 +42,6 @@ module Bootstrap
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 @@ module Bootstrap
)
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.
View
8 railties/test/application/configuration_test.rb
@@ -671,5 +671,13 @@ def index
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
Please sign in to comment.
Something went wrong with that request. Please try again.