"log4j2 configuration will not load custom pattern converter" Code Answer

4

to make a long story short, since version 2.0-rc2, the packages attribute does not work any more. instead, there is an annotation processor in log4j-core that will (should?) run during the build and will generate a metadata file for your custom plugins in your jar file. when log4j2 starts it will look for the metadata file in all jar files and quickly discover all available plugins.

the annotation processor works when compiling with maven or with plain javac, but it may not work well when compiling in eclipse. you need to enable annotation processing with right-click on a project > properties > java compiler > annotation processing.

still, i am not 100% sure this will work from eclipse. for now, one alternative is to build your custom plugin with maven.

i will try to make the packages attribute work again in an upcoming release.

this issue is tracked here: https://issues.apache.org/jira/browse/log4j2-741

update (7/28) this is fixed in trunk and will be included in the 2.0.1 release.

By EDi on March 23 2022

Answers related to “log4j2 configuration will not load custom pattern converter”

Only authorized users can answer the Search term. Please sign in first, or register a free account.