aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/tagged_logging.rb
diff options
context:
space:
mode:
authorThierry Joyal <thierry.joyal@gmail.com>2017-01-24 12:48:43 +0000
committerThierry Joyal <thierry.joyal@gmail.com>2017-02-27 21:01:30 +0000
commit62fba74932a72ee8104712a3db432b593fe0c6af (patch)
tree8aec22292596886a1a0dac60cb57c0fd47967b20 /activesupport/lib/active_support/tagged_logging.rb
parent4cc1c14493e7a9bd188ee13c237366f6bc2e13f4 (diff)
downloadrails-62fba74932a72ee8104712a3db432b593fe0c6af.tar.gz
rails-62fba74932a72ee8104712a3db432b593fe0c6af.tar.bz2
rails-62fba74932a72ee8104712a3db432b593fe0c6af.zip
TaggedLogging to return a new logger instance
Diffstat (limited to 'activesupport/lib/active_support/tagged_logging.rb')
-rw-r--r--activesupport/lib/active_support/tagged_logging.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb
index ad134c49b6..387bd69afa 100644
--- a/activesupport/lib/active_support/tagged_logging.rb
+++ b/activesupport/lib/active_support/tagged_logging.rb
@@ -57,8 +57,15 @@ module ActiveSupport
end
def self.new(logger)
- # Ensure we set a default formatter so we aren't extending nil!
- logger.formatter ||= ActiveSupport::Logger::SimpleFormatter.new
+ logger = logger.dup
+
+ if logger.formatter
+ logger.formatter = logger.formatter.dup
+ else
+ # Ensure we set a default formatter so we aren't extending nil!
+ logger.formatter = ActiveSupport::Logger::SimpleFormatter.new
+ end
+
logger.formatter.extend Formatter
logger.extend(self)
end