diff options
author | Alexander Staubo <alex@bengler.no> | 2013-01-24 22:39:19 +0100 |
---|---|---|
committer | Alexander Staubo <alex@bengler.no> | 2013-01-24 22:39:19 +0100 |
commit | 7cd0b7982520e410494e834edaa9be855d2920ad (patch) | |
tree | 0295435896a8174da08054e15e56f6a8fd99fd89 /activesupport/lib | |
parent | e20c0e3a8f17d716720d248d3db5f022f7cb021a (diff) | |
download | rails-7cd0b7982520e410494e834edaa9be855d2920ad.tar.gz rails-7cd0b7982520e410494e834edaa9be855d2920ad.tar.bz2 rails-7cd0b7982520e410494e834edaa9be855d2920ad.zip |
Fix TaggedLogging to allow loggers to be instantiated multiple times without having to share the stack of tags. This is accomplished by using a unique key for the thread-local tag list. Fixes #9064.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/tagged_logging.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb index 18bc919734..a670d01685 100644 --- a/activesupport/lib/active_support/tagged_logging.rb +++ b/activesupport/lib/active_support/tagged_logging.rb @@ -42,7 +42,9 @@ module ActiveSupport end def current_tags - Thread.current[:activesupport_tagged_logging_tags] ||= [] + # We use our object ID here to void conflicting with other instances + thread_key = @thread_key ||= "activesupport_tagged_logging_tags:#{object_id}".freeze + Thread.current[thread_key] ||= [] end private |