zookeeper log及out文件输入路径配置【一篇就够】
1、修改$ZOOKEEPER_HOME/bin目录下的zkEnv.sh文件 ZOO_LOG_DIR指定想要输出到哪个目录, ZOO_LOG4J_PROP,指定INFO,ROLLINGFILE的日志APPENDER. 54 if [ "x${ZOO_LOG_DIR}" = "x" ] 55 then 56 ZOO_LOG
1、修改$ZOOKEEPER_HOME/bin目录下的zkEnv.sh文件
ZOO_LOG_DIR指定想要输出到哪个目录,
ZOO_LOG4J_PROP,指定INFO,ROLLINGFILE的日志APPENDER.
54 if [ "x${ZOO_LOG_DIR}" = "x" ]
55 then
56 ZOO_LOG_DIR="/usr/zookeeper-3.4.12/logs"
57 fi
58
59 if [ "x${ZOO_LOG4J_PROP}" = "x" ]
60 then
61 ZOO_LOG4J_PROP="INFO,ROLLINGFILE"
62 fi
2、修改$ZOOKEEPER_HOME/conf/log4j.properties文件
zookeeper.root.logger的值与前一个文件的ZOO_LOG4J_PROP保持一致
该日志配置是以日志文件大小轮转的
如果想要按照天轮转,可以修改为DaliyRollingFileAppender.
1 # Define some default values that can be overridden by system properties
2 zookeeper.root.logger=INFO, ROLLINGFILE
3 zookeeper.console.threshold=INFO
4 zookeeper.log.dir=.
5 zookeeper.log.file=zookeeper.log
6 zookeeper.log.threshold=DEBUG
7 zookeeper.tracelog.dir=.
8 zookeeper.tracelog.file=zookeeper_trace.log
9
10 #
11 # ZooKeeper Logging Configuration
12 #
13
14 # Format is "<default threshold> (, <appender>)+
15
16 # DEFAULT: console appender only
17 log4j.rootLogger=${zookeeper.root.logger}
18
19 # Example with rolling log file
20 #log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE
21
22 # Example with rolling log file and tracing
23 #log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE
24
25 #
26 # Log INFO level and above messages to the console
27 #
28 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
29 log4j.appender.CONSOLE.Threshold=${zookeeper.console.threshold}
30 log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
31 log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n
32
33 #
34 # Add ROLLINGFILE to rootLogger to get log file output
35 # Log DEBUG level and above messages to a log file
36 #log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender
37 log4j.appender.ROLLINGFILE=org.apache.log4j.DailyRollingFileAppender
38 log4j.appender.ROLLINGFILE.Threshold=${zookeeper.log.threshold}
39 log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/${zookeeper.log.file}
40
41 # Max log file size of 10MB
42 log4j.appender.ROLLINGFILE.MaxFileSize=10MB
43 # uncomment the next line to limit number of backup files
44 #log4j.appender.ROLLINGFILE.MaxBackupIndex=10
45
46 log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout
47 log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n
48
49
50 #
51 # Add TRACEFILE to rootLogger to get log file output
52 # Log DEBUG level and above messages to a log file
53 log4j.appender.TRACEFILE=org.apache.log4j.FileAppender
54 log4j.appender.TRACEFILE.Threshold=TRACE
55 log4j.appender.TRACEFILE.File=${zookeeper.tracelog.dir}/${zookeeper.tracelog.file}
56
57 log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout
58 ### Notice we are including log4j's NDC here (%x)
59 log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L][%x] - %m%n
更多推荐
所有评论(0)