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 "Scott Deboy (JIRA)" <ji...@apache.org> on 2013/03/14 06:08:13 UTC

[jira] [Comment Edited] (LOG4J2-175) Plugin cache should be reset when addPackages is called

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

Scott Deboy edited comment on LOG4J2-175 at 3/14/13 5:08 AM:
-------------------------------------------------------------

While testing my change to make advertiser a plugin, I had to define the configuration with packages="org.apache.logging.log4j.core,org.apache.logging.log4j.test", as the InMemoryAdvertiser is under the test source tree under the 'core' package hierarchy.

This wasn't sufficient to have the configuration's pluginmanager resolve the plugin, as the plugintype cache had previously been built for 'core'. 

Two changes needed to be made:
 - There is already a static cache of plugintypes to plugins, so addPackage now resets that cache.  
 - As there is already a cache of plugintypes to plugins, there is no need to also cache them again in a pluginManager member of the configuration.  Changed getPluginManager on BaseConfiguration to create a new PluginManager instance and call collectPlugins before returning the new PluginManager instance.
                
      was (Author: sdeboy):
    While testing my change to make advertiser a plugin, I had to add the 'core' package, as the InMemoryAdvertiser is under the test source tree under the 'core' package hierarchy.

This wasn't sufficient to have the configuration's pluginmanager resolve the plugin, as the plugintype cache had previously been built for 'core'. 

Two changes needed to be made:
 - There is already a static cache of plugintypes to plugins, so addPackage now resets that cache.  
 - As there is already a cache of plugintypes to plugins, there is no need to also cache them again in a pluginManager member of the configuration.  Changed getPluginManager on BaseConfiguration to create a new PluginManager instance and call collectPlugins before returning the new PluginManager instance.

                  
> Plugin cache should be reset when addPackages is called
> -------------------------------------------------------
>
>                 Key: LOG4J2-175
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-175
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: Scott Deboy
>            Assignee: Scott Deboy
>
> If there are packages defined on the configuration, but the 'element type' plugin cache has already been built, plugins for the new package are never found.
> I have a fix and I'll commit shortly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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