[
https://issues.apache.org/jira/browse/LOG4J2-2177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16314786#comment-16314786
]
Gary Gregory commented on LOG4J2-2177:
--------------------------------------
Like it says on the tin, the goal here is to remove use of our method
{{org.apache.logging.log4j.core.impl.Log4jLogEvent.Builder.setContextMap(Map<String,
String>)}}. Eventually, one day, it will go away, right? Hence the deprecation.
I will put to the side my head-scratching as to whether or not we *_really_*
need our two {{StringMap}} and {{IndexedStringMap}} interfaces and the
confusion of their names, since they are not JRE {{Map}} s.
As an exercise, you can checkout the 2.10.0 tag and see how _you_ would
eliminate the use {{setContextMap(Map<String, String>)}}.
Do you end up down the same path I did?
Some of this is replacing in tests the use of {{new HashMap()}} with
{{org.apache.logging.log4j.core.impl.ContextDataFactory.createContextData()}}.
But even that is not great because "client" code ends up using a "core.impl"
class as opposed to just a "core" class. The "client" could use
{{org.apache.logging.log4j.util.SortedArrayStringMap}} directly instead which
is in {{log4j-api}}, but then why bother with having a {{ContextDataFactory}}?
So I went with using the {{ContextDataFactory}} wrapper.
Please do not take this the wrong way, but it just feels to me that the
refactoring around {{StringMap}} and {{IndexedStringMap}} was not followed all
the way through because {{setContextMap(Map<String, String>)}} was not cleaned
up.
Thoughts?
> 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)