On my zookeeper log4j configuration, I have logger for console and rolling file.
I ran my zookeeper using systemctl.
In zookeeper/bin/zkServer.sh, there's this line
_ZOO_DAEMON_OUT="$ZOO_LOG_DIR/zookeeper.out"
which I assume is where the console logger for zookeeper.
One day the zookeeper.out got too big, and to clean it up, I need to stop zookeeper, delete zookeeper.out, and start zookeeper.
Question: Is there a way to rotate the zookeeper.out?
You need to remove the CONSOLE
log appender from your log4j properties.
Please check out this post on Cloudera.
Just switch to ROLLINGFILE
instead.
log4j.rootLogger=INFO, ROLLINGFILE
log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/zookeeper.log
log4j.appender.ROLLINGFILE.MaxFileSize=5MB
log4j.appender.ROLLINGFILE.MaxBackupIndex=10