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

Remko Popma commented on LOG4J2-2177:
-------------------------------------

I understand the goal of the ticket. I was hoping to understand what problem 
you ran into that required changing the return type of {{ContextDataFactory}} 
without duplicating your effort. 

I agree with your choice of using {{ContextDataFactory}} rather than using 
{{SortedArrayStringMap}}. Note that the factory only provides the initial 
instance. The context data that ends up in the log event comes from the context 
data injector, most likely 
[ThreadContextDataInjector|https://logging.apache.org/log4j/2.x/log4j-core/xref/org/apache/logging/log4j/core/impl/ThreadContextDataInjector.html].
 This may replace the initial value with a {{JdkMapAdapterStringMap}}. So there 
really are other StringMap implementations. 

You are right that the original context data refactoring did not completely 
replace all usages of {{setContextMap}}. I focused on the usages where becoming 
garbage free would have the most impact. I appreciate you taking the time to 
make things fully consistent. 

> Replace use of deprecated Core API 
> org.apache.logging.log4j.core.impl.Log4jLogEvent.Builder.setContextMap(Map<String,
>  String>)
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2177
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2177
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.10.0
>            Reporter: Gary Gregory
>            Assignee: Gary Gregory
>
> Replace use of deprecated Core API 
> {{org.apache.logging.log4j.core.impl.Log4jLogEvent.Builder.setContextMap(Map<String,
>  String>)}}
> In order to implement this cleanly, the internal class 
> {{org.apache.logging.log4j.core.impl.ContextDataFactory}} will change its API 
> return values from {{StringMap}} to {{IndexedStringMap}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to