[
https://issues.apache.org/jira/browse/LOG4J2-745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14092217#comment-14092217
]
Matt Sicker commented on LOG4J2-745:
------------------------------------
Alright, here's the rundown on the patch:
# This patch needs to be rebased on the current trunk. {{PluginManager}}
specifically fails to patch properly now.
# The manual shouldn't be calling attention to the internal details of the
plugin cache file. This could be changed in the future, and we don't consider
this to be a part of the public API.
# Neat idea refactoring {{PluginType}}. I like that.
# The split of the registry into three maps is a rather good idea.
# For system properties, please use
{{PropertiesUtil.getProperties().getStringProperty()}} instead of
{{System.getProperty()}}. This allows for overriding system properties in an
embedded properties file. The javadocs in log4j-api provide some basic details.
For this scenario, you can obviously ignore the "consider this class private".
# LOG4J2-769 was fixed separately, so if there's difference in implementation
for this patch, it should be reconciled.
# Does the packages list really need to be passed around so much? I would think
that you could add packages to the central registry during config file scanning
which could be queried globally.
> Plugins can cause ConverterKeys collisions with unpredictable results
> ---------------------------------------------------------------------
>
> Key: LOG4J2-745
> URL: https://issues.apache.org/jira/browse/LOG4J2-745
> Project: Log4j 2
> Issue Type: Improvement
> Reporter: Scott Harrington
> Assignee: Matt Sicker
> Priority: Minor
> Attachments: LOG4J2-745-patch.txt
>
>
> If I create a Converter plugin with ConverterKeys of "d" or "m" then there
> will be a collision with the built-in DatePatternConverter or
> MessagePatternConverter.
> It is unpredictable which plugin gets used.
> I see two resolutions:
> (1) detect collisions in PatternParser and emit a warning so we know which
> implementation will be used
> (2) use whichever Log4j2Plugins.dat appeared first in the CLASSPATH
> Predictable iteration order is usually accomplished by replacing HashMaps
> with LinkedHashMaps. Could easily do this for thie PluginManager.plugins
> field. But PluginRegistry uses a ConcurrentHashMap.
> Is there a good reason to use ConcurrentHashMaps in PluginRegistry? It
> doesn't really give you any concurrency -- a caller to
> PluginManager.getPlugins could see a partially-loaded map if collectPlugins
> was still running. Why not synchronize collectPlugins and/or loadPlugins, and
> force any concurrent caller to getPlugins to wait until the loading was
> complete.
> I would give it a stab but I see other more important changes are probably
> underway for LOG4J2-741 and LOG4J2-673 and this can probably wait.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]