Log4j2 config - packages property for plugins will be deprecated
Hello colleagues,
I just build in log4j2 with the exemplary config provided here: https://github.com/SAP/cf-java-logging-support/blob/main/sample/src/main/resources/log4j2.xml
When running my tests so far, I receive a warning:
WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release
At the official page they mark it also as deprecated: https://logging.apache.org/log4j/2.x/manual/plugins.html
Not sure if you need to adapt the implementation of your actual plugins, but at least the configs needs to be adapted.
Kind regards Hendrik
Hi Hendrik,
Thanks for reaching out. In my understanding, the package scanning is required to find the @Plugin annotations, e.g. in https://github.com/SAP/cf-java-logging-support/blob/936f7a735d8c26cd1f62bcb9cd35a414a054d809/cf-java-logging-support-log4j2/src/main/java/com/sap/hcp/cf/log4j2/layout/JsonPatternLayout.java#L60-L61. I will investigate, what can be done to avoid the warnings.
Best Regards, Karsten
Hi Karsten,
as described here: https://logging.apache.org/log4j/2.x/manual/plugins.html
as far as I understand it you would only need to add the execution for the pluginProcessor in your maven-compiler-plugin which then outputs a metadata file for the found plugins? Not sure if I got that right
Below that is a text with another couple of requirements a plugin needs to fulfill, not sure if that is already done with the current implementation fo your plugins
I will try to implement the documented first approach "Serialized plugin listing files on the classpath.".