[ https://issues.apache.org/jira/browse/LOG4J2-1348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15244495#comment-15244495 ]
Remko Popma edited comment on LOG4J2-1348 at 4/17/16 12:59 AM: --------------------------------------------------------------- Ralph's comment made me realize: the static methods cannot return {{this}} but can return a helper object with the same put/push methods. These methods can be implemented by returning the result of calling the static methods on ClosableThreadContext again. was (Author: rem...@yahoo.com): Ralph's comment made me realize: the static method can return a helper object with the same put/push methods. These methods can be implemented by returning the result of calling the static methods on ClosableThreadContext again. > Add an AutoCloseable ThreadContext class: CloseableThreadContext > ---------------------------------------------------------------- > > Key: LOG4J2-1348 > URL: https://issues.apache.org/jira/browse/LOG4J2-1348 > Project: Log4j 2 > Issue Type: Improvement > Components: API > Reporter: Greg Thomas > Assignee: Gary Gregory > Priority: Minor > Fix For: 2.6 > > Attachments: CloseableThreadContext.zip, ctc-also.patch, ctc.patch, > thread-context.xml.patch > > > The log4j2 API provides a ThreadContext - > https://logging.apache.org/log4j/2.x/manual/thread-context.html - that > allows items to be added to a stack or a map for logging, and then > subsequently removed once they are no longer required. > This sounds like an ideal candidate for a AutoCloseable implementation so > that items are removed automatically and no longer left around littering the > stack/map. -- 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