logstash cannot find log4j2.properties file

懵懂的女人 提交于 2019-12-23 01:11:26

问题


I have been trying to setup a proof of concept elasticsearch/kibana/logstash environment, but it is not working at the moment.

The LOGSTASH_HOME is:

c:\_work\issues\log4j_socketappender\logstash-5.0.1\

In the console log of logstash I found the following line:

Could not find log4j2 configuration at path /_work/issues/log4j_socketappender/logstash-5.0.1/config/log4j2.properties. Using default config which logs to console

You can see logstash is trying to look for log4j2.properties in the right location but it does not contain the "c:" part

I tried adding the path to the config\jvm.options

 -Dlog4j.configurationFile=c:\_work\issues\log4j_socketappender\logstash-5.0.1\log4j2.properties

but it did not work.


回答1:


Eventually I fixed it by adding the following line into bin\setup.bat

42.   SET JAVA_OPTS=%JAVA_OPTS% -Dlog4j.configurationFile=%LS_HOME%\config\log4j2.properties



回答2:


Two things come to mind:

Try specifying the full path with -Dlog4j.configurationFile=c:\_work\issues\log4j_socketappender\logstash-5.0.1\log4j2.properties

Also, is the properties file using the new Log4j2 properties syntax? An old log4j 1.2-style properties file will not work. (Although I would expect a different error message in that case.)




回答3:


as you can see here

create an Environment Variable in Windows LS_SETTINGS_DIR and set it to:

        /c:/logstash-5.0.1/config

(notice - leading forward slash and all slashes are unix style not Windows style backslashes)

or to invoke logstash with

      --path.settings=/c:/logstash-5.0.1/config/

(again note position and direction of slashes)

I hope that this helps someone avoid the Googling and testing I have just done!



来源:https://stackoverflow.com/questions/40676294/logstash-cannot-find-log4j2-properties-file

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