This would be a perfect case to go ahead and create it and either attach it as a patch to a Jira issue or reference it in a pull request from a Jira issue.
Ralph > On Apr 1, 2016, at 3:16 AM, Greg Thomas <[email protected]> wrote: > > I was looking at the ThreadContext section of the API @ > http://logging.apache.org/log4j/2.x/manual/thread-context.html - > particularly the Thread Context Map > > Given it's important to remember to clear the map at the "end" of > processing, would this be a good case for an auto-closeable, so you > could do something like (based on the documented example) ... > > try (final CloseableThreadContext ctc = new > CloseableThreadContext("id", UUID.randomUUID().toString(), > "ipAddress", request.getRemoteAddr())) { > > logger.debug("Message 1"); > ... > logger.debug("Message 2"); > ... > } > > i.e. creating the object adds the key/value pairs to the Thread > Context Map, and when the object is auto-closed they are automatically > removed from the Thread Context Map (or returned to their original > value). > > Have I missed anything? > > (and as I finished writing this, it strikes me that I don't need any > changes to the API, I can do this independently, but it may be worth > adding). > > Greg > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
