You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2016/04/01 17:46:25 UTC

[jira] [Commented] (LOG4J2-1348) AutoCloseable ThreadContext access

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

Gary Gregory commented on LOG4J2-1348:
--------------------------------------

Everything in {{ThreadContext}} is static so I do not see how you would use it in a try-with-resources. Unless you'd want a {{close()}} method to clear all the static data?

> AutoCloseable ThreadContext access
> ----------------------------------
>
>                 Key: LOG4J2-1348
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1348
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: 2.5
>            Reporter: Greg Thomas
>            Priority: Minor
>
> 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-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org