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

plugin preloading fails in shaded jar files

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.0-rc2, 2.1
    • Fix Version/s: None
    • Component/s: Core

      Description

      Support for plugin preloading through the standard javax.annotation.processing tool was adding in LOG4J2-595

      But the plugin processor always creates and stores the processed "Plugin" annotated classes into the same file. This works fine when the classpath consists of individual jar files, but fails when shaded jar files are used.

      A tested fix exists at https://github.com/finn-no/logging-log4j2/tree/bugfix/LOG4J2-673
      There's also a github pull request and a manual diff attached. (I can clean up anything not used afterwards)

      The fix saves the dat file in a location under META-INF that matches the shared package all the processed plugins are found under.
      The package attribute in the config file is then used so that multiple dat files can be loaded at runtime.
      This means that the package attribute is no longer deprecated.

      This has been tested against https://github.com/finn-no/log4j2-logstash-jsonevent-layout

        Attachments

          Activity

            People

            • Assignee:
              jvz Matt Sicker
              Reporter:
              michaelsembwever mck
            • Votes:
              16 Vote for this issue
              Watchers:
              21 Start watching this issue

              Dates

              • Created:
                Updated: