Why does zookeeper not use my log4j.properties file log directory

后端 未结 6 389
醉话见心
醉话见心 2020-12-13 13:41

In my zookeeper/conf/log4j.properties file I set the zookeeper.log.dir to $HOME/zklogs

When I use zkServer.sh it does not use that directory. Instead it uses the ${Z

6条回答
  •  一个人的身影
    2020-12-13 14:31

    zkServer.sh gets it's environment variables from zkEnv.sh The env file sets a classpath which includes the log4j file if it's at the expected location.

    ZOOXFGDIR=ZOOBINDIR/../conf

    I dropped some echos into zkServer.sh to trace what's going on. I found that classpath was being set properly, but logdir and log4j_prop were not being set. So I added them to zkEnv.sh. Logs appear to be showing up in the expected location now.

    ZOO_LOG_DIR="/var/log/zookeeper"
    ZOO_LOG4J_PROP="INFO,ROLLINGFILE"
    

提交回复
热议问题