[
https://issues.apache.org/jira/browse/LOG4J2-1692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15663191#comment-15663191
]
ASF GitHub Bot commented on LOG4J2-1692:
----------------------------------------
Github user GregDThomas commented on a diff in the pull request:
https://github.com/apache/logging-log4j2/pull/48#discussion_r87757741
--- Diff:
log4j-api/src/main/java/org/apache/logging/log4j/CloseableThreadContext.java ---
@@ -74,6 +74,31 @@ private CloseableThreadContext() {
return new CloseableThreadContext.Instance().put(key, value);
}
+ /**
+ * Populates the Thread Context Stack with the supplied stack. The
information will be popped off when
+ * the instance is closed.
+ *
+ * @param values The stack of values to be added
+ * @return a new instance that will back out the changes when closed.
+ * @since 2.7.1
+ */
+ public static CloseableThreadContext.Instance pushAll(final
ThreadContext.ContextStack stack) {
--- End diff --
I was anticipating that the usage will be simply
`ThreadContext.getImmutableStack()` but as you say `List` is probably easier
(and more closely aligns with the `Map` used for `putAll(...)`).
> putAll() method for CloseableThreadContext
> ------------------------------------------
>
> Key: LOG4J2-1692
> URL: https://issues.apache.org/jira/browse/LOG4J2-1692
> Project: Log4j 2
> Issue Type: Improvement
> Components: API
> Affects Versions: 2.6, 2.7
> Reporter: Greg Thomas
> Assignee: Mikael Ståldal
> Priority: Minor
>
> The ThreadContext supports a putAll(final Map<String, String> m) method.
> It would be useful, particularly when using thread pools, to have a similar
> method for the CloseableThreadContext.
> Similarly, a pushAll() method would be useful.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]