gpt4 book ai didi

elasticsearch - 错误无法定位插件类型 [对于 RollingFile 和 TimeBasedTriggeringPolicy]

转载 作者:行者123 更新时间:2023-11-29 02:50:48 24 4
gpt4 key购买 nike

我开始按照官方说明开始使用 docker elasticsearch 5.0.1 实例:

https://www.elastic.co/guide/en/elasticsearch/reference/5.0/settings.html

为了配置 elasticsearch.yml 和 log4j2.properties 文件,这些文件位于:

$ pwd
/system/mesos/elasticsearchf/config
$ ls
elasticsearch.yml log4j2.properties

包含这些配置文件:

$cat elasticsearch.yml
path:
data: /usr/share/elasticsearch/data
logs: /usr/share/elasticsearch/data
shared_data: /usr/share/elasticsearch/data
config: /usr/share/elasticsearch/config

node.add_lock_id_to_custom_path: false
index.number_of_shards: 2
cluster.name: elasticcluster
discovery.zen.ping.unicast.hosts: ["10.120.1.190", "10.120.1.191"]

$cat log4j2.properties
appender.rolling.type = RollingFile
appender.rolling.name = rolling
appender.rolling.fileName = ${sys:es.logs}.log
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %.10000m%n
appender.rolling.filePattern = ${sys:es.logs}-%d{yyyy-MM-dd}.log
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
appender.rolling.policies.time.modulate = true

当我运行命令时:

$ docker -D -H unix:///var/run/docker.sock run --cpu-shares 1024 --memory 2634022912 -e ES_JAVA_OPTS="-Xms2G -Xmx2G" -v /system/mesos/elasticsearchf/data:/usr/share/elasticsearch/data/:rw -v /system/mesos/elasticsearchf/config:/usr/share/elasticsearch/config/:rw --net bridge -p 9200:9200/tcp -p 9300:9300/tcp docker.elastic.co/elasticsearch/elasticsearch:5.0.1

我收到了与 log4j2 消息相关的错误消息,您可以在下面看到

欢迎任何帮助

亲切的问候

DEBU[0001] framesize: 81
2016-12-01 10:37:15,526 main ERROR Unable to locate plugin type for RollingFile
DEBU[0001] framesize: 90
2016-12-01 10:37:15,554 main ERROR Unable to locate plugin for TimeBasedTriggeringPolicy
DEBU[0001] framesize: 2223
2016-12-01 10:37:15,555 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy for element Policies. java.lang.NullPointerException
at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:52)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:243)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:131)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:249)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:116)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:83)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:249)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103)
at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)
at org.elasticsearch.cli.Command.main(Command.java:62)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)

DEBU[0001] framesize: 76
2016-12-01 10:37:15,557 main ERROR Unable to locate plugin for RollingFile
DEBU[0001] framesize: 1974
2016-12-01 10:37:15,558 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.config.AppendersPlugin for element Appenders. java.lang.NullPointerException
at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:52)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:243)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:131)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:249)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:116)
at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:83)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:249)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103)
at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)
at org.elasticsearch.cli.Command.main(Command.java:62)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)

DEBU[0002] Corrupted prefix: []
DEBU[0002] [hijack] End of stdout

最佳答案

我尝试在 Docker 上运行 Elasticsearch 5.3 时遇到了完全相同的错误,并且我使用的属性与 Elasticsearch 日志记录配置部分中提到的类似。我花了一段时间才弄清楚为什么会出现此错误。这是因为在定义类型属性时行尾有一个空格。行末不应有任何空格。

appender.rolling.type = RollingFile
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy

一旦你删除了空格(使用问题中提到的配置),你的 Elasticsearch 就会出现,但你仍然不会得到任何日志,因为它覆盖了在控制台中显示错误的默认设置,并且也没有添加滚动附加程序到根记录器。要查看生成的日志信息,您还需要将以下两行添加到您的 log4j2.properties

rootLogger.level = info
rootLogger.appenderRef.rolling.ref = rolling

关于elasticsearch - 错误无法定位插件类型 [对于 RollingFile 和 TimeBasedTriggeringPolicy],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40908998/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com