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 <ga...@gmail.com> on 2015/06/10 09:42:28 UTC

Re:

On Fri, May 29, 2015 at 1:03 AM, Mikael Ståldal <mi...@magine.com>
wrote:

> Now when this is changed, what is the actual purpose for
> ThreadContextMap.getCopy() and ThreadContext.getContext()?
>

That's probably a question for Ralph...

Gary


> It seems like the only usage is
> in org.apache.logging.slf4j.Log4jMDCAdapter.
>
>
> On Fri, May 29, 2015 at 2:14 AM, Gary Gregory <ga...@gmail.com>
> wrote:
>
>> Please verify and close: [LOG4J2-1033] SimpleLogger creates unnecessary
>> Map objects by calling ThreadContext.getContext() instead of
>> getImmutableContext().
>>
>> Gary
>>
>> On Thu, May 28, 2015 at 3:31 AM, Mikael Ståldal <
>> mikael.staldal@magine.com> wrote:
>>
>>> From org.apache.logging.log4j.simple.SimpleLogger, line 147-151:
>>>
>>> if (showContextMap) {
>>>     final Map<String, String> mdc = ThreadContext.getContext();
>>>     if (mdc.size() > 0) {
>>>         sb.append(SPACE);
>>>         sb.append(mdc.toString());
>>>         sb.append(SPACE);
>>>     }
>>> }
>>>
>>>
>>> Why not use ThreadContext.getImmutableContext() here?
>>>
>>>
>>> --
>>> [image: MagineTV]
>>>
>>>  *Mikael Ståldal*
>>> Senior backend developer
>>>
>>>  *Magine TV*
>>>  mikael.staldal@magine.com
>>>  Regeringsgatan 25  | 111 53 Stockholm, Sweden  |   www.magine.com
>>>
>>>  Privileged and/or Confidential Information may be contained in this
>>> message. If you are not the addressee indicated in this message
>>> (or responsible for delivery of the message to such a person), you may
>>> not copy or deliver this message to anyone. In such case,
>>> you should destroy this message and kindly notify the sender by reply
>>> email.
>>>
>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> [image: MagineTV]
>
>  *Mikael Ståldal*
> Senior backend developer
>
>  *Magine TV*
>  mikael.staldal@magine.com
>  Regeringsgatan 25  | 111 53 Stockholm, Sweden  |   www.magine.com
>
>  Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re:

Posted by Remko Popma <re...@gmail.com>.
We can mark it deprecated but we cannot remove it in the 2.x stream. 

Sent from my iPhone

> On 2015/06/10, at 16:42, Gary Gregory <ga...@gmail.com> wrote:
> 
>> On Fri, May 29, 2015 at 1:03 AM, Mikael Ståldal <mi...@magine.com> wrote:
>> Now when this is changed, what is the actual purpose for ThreadContextMap.getCopy() and ThreadContext.getContext()?
> 
> That's probably a question for Ralph...
> 
> Gary
> 
>> 
>> It seems like the only usage is in org.apache.logging.slf4j.Log4jMDCAdapter.
>> 
>> 
>>> On Fri, May 29, 2015 at 2:14 AM, Gary Gregory <ga...@gmail.com> wrote:
>>> Please verify and close: [LOG4J2-1033] SimpleLogger creates unnecessary Map objects by calling ThreadContext.getContext() instead of getImmutableContext().
>>> 
>>> Gary
>>> 
>>>> On Thu, May 28, 2015 at 3:31 AM, Mikael Ståldal <mi...@magine.com> wrote:
>>>> From org.apache.logging.log4j.simple.SimpleLogger, line 147-151:
>>>> 
>>>> if (showContextMap) {
>>>>     final Map<String, String> mdc = ThreadContext.getContext();
>>>>     if (mdc.size() > 0) {
>>>>         sb.append(SPACE);
>>>>         sb.append(mdc.toString());
>>>>         sb.append(SPACE);
>>>>     }
>>>> }
>>>> 
>>>> Why not use ThreadContext.getImmutableContext() here?
>>>> 
>>>> -- 
>>>>  
>>>> 
>>>> Mikael Ståldal
>>>> Senior backend developer 
>>>> 
>>>> Magine TV
>>>> mikael.staldal@magine.com    
>>>> Regeringsgatan 25  | 111 53 Stockholm, Sweden  |   www.magine.com 
>>>> 
>>>> Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message
>>>> (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, 
>>>> you should destroy this message and kindly notify the sender by reply email.   
>>> 
>>> 
>>> 
>>> -- 
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>>> Java Persistence with Hibernate, Second Edition
>>> JUnit in Action, Second Edition
>>> Spring Batch in Action
>>> Blog: http://garygregory.wordpress.com 
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>> 
>> 
>> 
>> -- 
>>  
>> 
>> Mikael Ståldal
>> Senior backend developer 
>> 
>> Magine TV
>> mikael.staldal@magine.com    
>> Regeringsgatan 25  | 111 53 Stockholm, Sweden  |   www.magine.com 
>> 
>> Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message
>> (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, 
>> you should destroy this message and kindly notify the sender by reply email.   
> 
> 
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory