Java Log4j2 with pax logging not creating the Log4j2Plugins.dat file in maven project

527 Views Asked by At

I want to implement a custom plugin with Log4j2 with ops4j-pax-logging but the Log4j2Plugins.dat is not getting created. When I use just Log4j2 it gets created with no issue.

1

There are 1 best solutions below

0
On BEST ANSWER

This was fixed by adding the plugin-processor in the pom.

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <executions>
                <execution>
                    <id>log4j-plugin-processor</id>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                    <phase>process-classes</phase>
                    <configuration>
                        <proc>only</proc>
                        <annotationProcessors>
                            <annotationProcessor>org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor</annotationProcessor>
                        </annotationProcessors>
                    </configuration>
                </execution>
            </executions>
        </plugin>