logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "MK (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-479) Use of InheritableThreadLocal in Map ThreadContext is dangerous and unhelpful
Date Fri, 03 Jan 2014 13:38:53 GMT

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

MK commented on LOG4J2-479:
---------------------------

One other thing I want to stress, is that missing thread context is very easy to spot and
diagnose -- we were initially using DefaultThreadContextStack and immediately knew why some
of the decorations were missing.
But the bug caused by the inheriting thread context is subtle, hard to notice because log
lines are decorated and, furthermore, they are decorated correctly while you are developing
in a single user environment.   That's why I strongly prefer no inheritance of the thread
context in this case.

> 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
>
> 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.1.5#6160)

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


Mime
View raw message