ppkarwasz commented on issue #2868: URL: https://github.com/apache/logging-log4j2/issues/2868#issuecomment-2302098928
> **The question is why I need to use plugin to fix this issue ? What is the change in 2.21.0 causing Log4j2Plugins.dat have problems ? Any solution for me not using that plugin ?** **TL;DR**: See [How do I create a single-JAR application containing Log4j Core?](https://logging.staged.apache.org/log4j/2.x/faq.html#single-jar) The Maven Shade Plugin creates a single-JAR application by copying all the files from the dependency JARs and putting them into a single JAR. Each time two or more JARs have a file with the same name, only one is kept and the other files are discarded. This usually breaks the application in some way. In order to deal with file name conflicts for each conflict you must configure an appropriate [Resource Transformer](https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html) to merge multiple files into one. The [Log4j Plugin Cache Transformer](https://logging.apache.org/log4j/transform/latest/#log4j-plugin-cache-transformer) is the appropriate resource transformer for `META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat` files. In the next release I added a FAQ entry on how to create single-JAR applications. You can see a preview version on [our staging site](https://logging.staged.apache.org/log4j/2.x/faq.html#single-jar). **Why did you application work with version `2.20.0`?** My guess is that the Maven Shade Plugin shades the JARs in some random, but deterministic order. When you used version `2.20.0`, Maven Shade **kept** the `Log4j2Plugins.dat` file from `log4j-core` and dropped the one from `log4j-1.2-api`. Now it **drops** the `Log4j2Plugins.dat` file from `log4j-core` and keeps the one from `log4j-1.2-api`. In both situation your application was somehow crippled, but since the plugins in `log4j-1.2-api` mostly concentrate on the support of the Log4j 1 configuration file format, you didn't notice that they were missing. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
