Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-798

jar scanning for plugins too expensive and called too many times

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.1, 2.0.2
    • 2.1
    • Core
    • None
    • modern hardware, fat jar

    Description

      related to: https://issues.apache.org/jira/browse/LOG4J2-741

      It takes about 3 seconds to perform PluginManager.collectPlugins() and it appears to run 4 times before log4j2 is done initializing. That is pretty not okay. Please consider making the plugin discovery method configurable and/or curtailing the redundant calls.

      My application jar uses the maven shade plugin. I do not specify a 'packages' attribute. I do use a custom plugin (a configuration factory), but I excluded the resultant plugin dat file created for it and specify its usage at runtime via the appropriate system property.

      My suggestion for the easiest fix is to use the pre-computed plugin list and optionally (maybe even enabled by default) also scan the class path for custom plugins.

      Some nice extras would be:

      • removing the redundant collectPlugins() calls
      • using a plugin dat file format that is both human friendly and amenable to append operations so that users of the maven shade plugin and users who struggle with annotation processors can easily include custom plugins. See https://github.com/addthis/codec for an example of such a plugin system/ file format that is based on hocon.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ianbarfield Ian Barfield
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: