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
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"