I was trying to use log4j2 HttpAppender, but I get this error:
ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.HttpAppender for element Http: java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.HttpAppender java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.HttpAppender
This is my log4j2.xml
configuration:
<Configuration>
<Appenders>
<Http name="HTTP" url="http://localhost:8055/log" verifyHostname="false" method="POST"/>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="HTTP"/>
</Root>
</Loggers>
</Configuration>
And these are some of the dependencies in my pom.xml
:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.23.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.23.1</version>
</dependency>
I also checked the classes in my target folder and the class public final class HttpAppender extends AbstractAppender
is present.
So, is my configuration wrong or what?
I also looked into this question, but my version of log4j2 is well above 2.7.
2