Permalink
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...
2 parents 7b5a452 + af1e3b7 commit 067393895d5677d15cd8de938ed772f28f69dd64 @rafaelfranca rafaelfranca committed Aug 4, 2013
@@ -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
@@ -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.
@@ -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

0 comments on commit 0673938

Please sign in to comment.