Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
Turing Sprint 163
Description
cms-commons contains the LookupFilter log4j2 plugin. For this a Log4j2Plugins.dat [1] cache file is included in the cms-commons jar.
When the Maven shade plugin is used to merge multple jars with such a Log4j2Plugins.dat file only one will survive.
See [3] for more information.
Without the plugin definitions errors are shown on startup:
ERROR StatusLogger Unrecognized format specifier [d]
ERROR StatusLogger Unrecognized conversion specifier [d] starting at position 16 in conversion pattern.
ERROR StatusLogger Unrecognized format specifier [thread]
ERROR StatusLogger Unrecognized conversion specifier [thread] starting at position 25 in conversion pattern.
Possible solutions
- Exclude all plugin cache files from the uberjar. Log4j will scan for plugins on startup. This will slow down the startup
- Exclude the cache file from cms-commons and don't use that filter in the log4j configuration
- Merge the cache files using a Maven transformation plugin [2]. Drawback is that this is log4j-version specific, currently using log4j 2.8.1
[1] META-INF/org/apache/logging\log4j/core/config/plugins/Log4j2Plugins.dat
[2] https://github.com/edwgiz/maven-shaded-log4j-transformer