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 "Simon Billingsley (JIRA)" <ji...@apache.org> on 2014/07/01 11:44:24 UTC

[jira] [Commented] (LOG4J2-479) Use of InheritableThreadLocal in Map ThreadContext is dangerous and unhelpful

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

Simon Billingsley commented on LOG4J2-479:
------------------------------------------

The ThreadContext.clear method was removed in 2.0-rc2 it is now called: clearAll
There are additional clear methods: clearMap and clearStack - I don't know when these were introduced.

This has caused issues with existing code that was written against 2.0-rc1

Also, the manual page still mentions using the clear method to clear the stack (in the stack example) when it should be clearStack ?
http://logging.apache.org/log4j/2.x/manual/thread-context.html

> Use of InheritableThreadLocal in Map ThreadContext is dangerous and unhelpful
> -----------------------------------------------------------------------------
>
>                 Key: LOG4J2-479
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-479
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: MK
>            Assignee: Remko Popma
>             Fix For: 2.0-rc1
>
>
> Described here http://logging.apache.org/log4j/2.x/manual/thread-context.html
> The use of InheritableThreadLocal creates subtle and hard to track bugs while not really adding much useful.  It is counterintuitive -- I don't see why would anyone expect logging context to be inherited.  But it breaks down completely when used with Thread Executors.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org