Log4j 2
  1. Log4j 2
  2. LOG4J2-175

Plugin cache should be reset when addPackages is called

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Issue Links

          Activity

          Hide
          Scott Deboy added a comment - - edited

          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.
          Show
          Scott Deboy added a comment - - edited 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.
          Hide
          Scott Deboy added a comment -

          Fixed in svn trunk revision 1456324

          Show
          Scott Deboy added a comment - Fixed in svn trunk revision 1456324

            People

            • Assignee:
              Scott Deboy
              Reporter:
              Scott Deboy
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development