修改Zookeeper日志输出路径,并按照日期输出

1、修改log4j.properties

vi  /opt/zookeeper-3.4.8/conf/log4j.properties

# Define some default values that can be overridden by system properties
zookeeper.root.logger=INFO,ROLLINGFILE 
zookeeper.console.threshold=INFO
zookeeper.log.dir=.
zookeeper.log.file=zookeeper.log
zookeeper.log.threshold=DEBUG
zookeeper.tracelog.dir=.
zookeeper.tracelog.file=zookeeper_trace.log


#
# Add ROLLINGFILE to rootLogger to get log file output
#    Log DEBUG level and above messages to a log file
# 按照日期每天输出logs
log4j.appender.ROLLINGFILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.ROLLINGFILE.Threshold=${zookeeper.log.threshold}
log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/${zookeeper.log.file}


# Max log file size of 10MB
#log4j.appender.ROLLINGFILE.MaxFileSize=10MB
# uncomment the next line to limit number of backup files
#log4j.appender.ROLLINGFILE.MaxBackupIndex=10



2、 修改zk Env.sh

vi  /opt/zookeeper-3.4.8/bin/zkEnv.sh

I…

if [ -f "$ZOOCFGDIR/Java.env" ]
then
    . "$ZOOCFGDIR/java.env"
fi


if [ "x${ZOO_LOG_DIR}" = "x" ]
then
#日志输出路径 不需mkdir zookeeper启动时自动创建
    ZOO_LOG_DIR="/opt/zookeeper-3.4.8/logs"
fi


if [ "x${ZOO_LOG4J_PROP}" = "x" ]
then
    ZOO_LOG4J_PROP="INFO,ROLLINGFILE"
fi


if [ "$JAVA_HOME" != "" ]; then
  JAVA="$JAVA_HOME/bin/java"
else
  JAVA=java
fi



输出的格式为:zookeeper.log

前一天日志的输出格式为:zookeeper.log.2016-09-01

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值