Elasticsearch “StatusLogger Log4j2 找不到日志记录实现。请将 log4j-core 添加到类路径中。

2022-09-03 05:26:47

我将 elasticsearch java 客户端从 2.3 升级到 5.1。

并且此错误日志继续显示。

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...

我正在使用 log4j2

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.7</version>
</dependency>
<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.7</version>
</dependency>

答案 1

答案很晚,但:)如果您不想升级ES,只需将以下依赖项添加到pom中即可:

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-to-slf4j</artifactId>
    <version>2.8.2</version>
</dependency>

应该修复它


答案 2

使用最新的帮助了我。log4j2

<dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.11.1</version>
</dependency>

推荐