[ 
https://issues.apache.org/jira/browse/LOG4J2-1692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15657527#comment-15657527
 ] 

ASF GitHub Bot commented on LOG4J2-1692:
----------------------------------------

Github user mikaelstaldal commented on a diff in the pull request:

    https://github.com/apache/logging-log4j2/pull/48#discussion_r87620526
  
    --- Diff: 
log4j-api/src/main/java/org/apache/logging/log4j/CloseableThreadContext.java ---
    @@ -128,6 +153,37 @@ public Instance put(final String key, final String 
value) {
             }
     
             /**
    +         * Populates the Thread Context Map with the supplied key/value 
pairs. Any existing keys in the
    +         * {@link ThreadContext} will be replaced with the supplied 
values, and restored back to their original value when
    +         * the instance is closed.
    +         *
    +         * @param values The map of key/value pairs to be added
    +         * @return a new instance that will back out the changes when 
closed.
    +         * @since 2.7.1
    +         */
    +        public Instance putAll(final Map<String, String> values) {
    +            for (final Map.Entry<String, String> entry : 
values.entrySet()) {
    +                put(entry.getKey(), entry.getValue());
    +            }
    +            return this;
    +        }
    +
    +        /**
    +         * 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
    --- End diff --
    
    The next version will be 2.8.


> 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
>            Reporter: Greg Thomas
>            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: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to