Skip to content

Commit f212fb8

Browse files
committed
Fix issue where bootstrap.rb overwrites the level of a BroadcastLogger's broadcasts.
In `bootstrap.rb` we set the `Rails.logger.level` to `config.log_level`. But at this point, we may have already set up a `BroadcastLogger` with multiple broadcasts that have different levels. So, calling `level=` on the `BroadcastLogger` will overwrite the level of the individual broadcasts. So instead, let's only set the `Rails.logger.level` if the logger is not a `BroadcastLogger`.
1 parent 10d880d commit f212fb8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

activesupport/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Fix issue where `bootstrap.rb` overwrites the `level` of a `BroadcastLogger`'s `broadcasts`.
2+
3+
*Andrew Novoselac*
4+
15
* Fix compatibility with the `semantic_logger` gem.
26

37
The `semantic_logger` gem doesn't behave exactly like stdlib logger in that

railties/lib/rails/application/bootstrap.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ module Bootstrap
5454
)
5555
logger
5656
end
57-
Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
5857

5958
unless Rails.logger.is_a?(ActiveSupport::BroadcastLogger)
59+
Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
6060
broadcast_logger = ActiveSupport::BroadcastLogger.new(Rails.logger)
6161
broadcast_logger.formatter = Rails.logger.formatter
6262
Rails.logger = broadcast_logger

0 commit comments

Comments
 (0)