简体   繁体   English

log4j2到弹性搜索配置

[英]log4j2 to elastic search configuration

I am trying to configure log4j2 to elasticsearch and got the next problem: 我正在尝试将log4j2配置为elasticsearch并遇到下一个问题:

ERROR No Elasticsearch client factory [JestHttp|ElasticsearchBulkProcessor] provided for AsyncBatchDelivery: clientObjectFactory 错误没有为AsyncBatchDelivery提供的Elasticsearch客户端工厂[JestHttp | ElasticsearchBulkProcessor]:clientObjectFactory

But I have property JestHttp set up, so, it should work as clientObjectFactory to my understanding. 但是我已经设置了属性JestHttp,因此,据我了解,它应该作为clientObjectFactory起作用。

Any ideas? 有任何想法吗?

my config file looks like that: 我的配置文件如下所示:

<Configuration status="INFO">
    <Appenders>
        <Elasticsearch name="elasticsearchAsyncBatch">
            <RollingIndexName indexName="log4j2" pattern="yyyy-MM-dd" />
            <AsyncBatchDelivery>
                <JestHttp serverUris="myhost:9200" />
            </AsyncBatchDelivery>
        </Elasticsearch>
    </Appenders>
    <Loggers>
        <Logger name="MyLogger" level="info" additivity="true">
            <AppenderRef ref="elasticsearchAsyncBatch" />
        </Logger>
    </Loggers>
</Configuration>

I'm the owner of this plugin. 我是此插件的所有者。 You need only one of the following: 需要以下之一:

  • log4j2-elasticsearch-jest log4j2-elasticsearch-jest
  • log4j2-elasticsearch(x)-bulkprocessor log4j2-elasticsearch(x)-批量处理器

log4j2-elasticsearch-core is a compile dependency of each one of them, so it will get there anyway. log4j2-elasticsearch-core是其中每一个的编译依赖项,因此无论如何都会到达那里。 It has to be specified only if you write your own extensions of core classses. 仅当您编写自己的核心类扩展时才必须指定它。

Looks like I needed not only log4j2-elasticsearch-core dependency, but log4j2-elasticsearch-jest as well. 看起来我不仅需要log4j2-elasticsearch-jest依赖,还需要log4j2-elasticsearch-jest。

So, just added the next code to pom: 因此,只需将下一个代码添加到pom中:

<dependency>
    <groupId>org.appenders.log4j</groupId>
    <artifactId>log4j2-elasticsearch-jest</artifactId>
    <version>1.1.1</version>
</dependency>

Maybe this will help someone else. 也许这会帮助别人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM