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

Use PluginBuilder for instantiating plugins

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • Plugins
    • None

    Description

      There are various places in the source code (in particular, Pattern and JSON Template layouts) where plugins are extensively used. There plugins are discovered via PluginManager but instantiated using some custom logic afterwards. This approach has serious caveats:

      • Code duplication
      • ConstraintValidator checks (e.g., RequiredClass) are ignored
      • Injection is ignored
      • All other PluginBuilder checks and functionalities are discarded and this breaks the plugin contract

      All plugins should rather be instantiated using PluginBuilder.

      This flaw also hints us that the developer-facing API of plugins is severely convoluted to the point of maintainers cannot simply discover-and-load a plugin without making a mistake. PluginUtil was an attempt to improve this situation, though it first needs to be used by the rest of the code base and it also suffers from the above custom instantiation logic shortcoming.

      Attachments

        Issue Links

          Activity

            People

              mattsicker Matt Sicker
              vy Volkan Yazici
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: