custom appender plugin not detected by log4j2

时间秒杀一切 提交于 2019-12-03 20:51:29
Sumalatha Abhishek

I added the package containing the Custom Appender in the Configuration of log4j2.xml before the appenders and it picked up the custom appender with no errors.

<Configuration packages="com.yourcompany.yourcustomappenderpackage">

I referred this thread - How to Create a Custom Appender in log4j2?

Majky

Looking into docs here, you are probably missing annotation processor configuration in your maven compiler plugin.

<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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!