Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix TaggedLogging to allow loggers to be instantiated multiple times without having to share the stack of tags #9065
…without having to share the stack of tags. This is accomplished by using a unique key for the thread-local tag list. Fixes #9064.
@carlosantoniodasilva: The tagged logger already uses a thread-local. The problem is that it acts as if there can only be a single tagged logger instance.
Here's my example from the previous issue (sorry about the dupe, didn't know Github listed pull requests in the issue tracker):
It's also not safe to wrap a unique logger (ie., one that does not delegate to a logger shared around in the app, like
In other words,
The fix uses a unique key to store the thread-local tag list. (The only weakness is that the thread-local key will never be garbage collected until the thread dies, but it seems unrealistic that anyone would create a huge number of loggers.)
@rafaelfranca Was this change ever released? Looks like it's not included in ActiveSupport 4.2.