Created on 06-12-2018 10:45 AM - edited 09-16-2022 06:20 AM
Hi guys,
Need to know how to set the zookeeper logs. Actually i think it is writing in /var/log/messages.
In older versions it wrote to zookeeper.out but not know.
Thanks
Created 06-12-2018 02:36 PM
Hey @Marc Vázquez!
Usually you will find a file named log4j.properties and there should exist a parameter called log4j.appender.ROLLINGFILE.File=<path>/zookeeper.log.
[root@node1 conf]# cat /etc/zookeeper/conf/log4j.properties | grep -i zookeeper.log # ZooKeeper Logging Configuration log4j.appender.ROLLINGFILE.File=/var/log/zookeeper/zookeeper.log
In confluent stack, i'm not sure about the path, but should it be something like: confluent_dss_version/etc/zookeeper/conf/log4j.properties.
Or you can try to search for it, like:
find / -name "zookeeper" -type d -exec ls -ltrah {} \;Hope this helps! 🙂
Created 06-13-2018 09:39 AM
However that folder doesn't exist in confluent. I only have log4j.properties in conluent_dir/etc/kafka/log4j.properties
Inside there's no zookeeper.log
Created 06-13-2018 03:36 PM
Hi @Marc Vázquez!
Could you check which command does Confluent stack runs for zk?
[root@node2 ~]# ps -ef | grep -i zookeeper
1001 3802 1 0 Jun12 ? 00:00:56 /usr/jdk64/jdk1.8.0_112/bin/java -Dzookeeper.log.dir=/var/log/zookeeper -Dzookeeper.log.file=zookeeper-zookeeper-server-node2.log -Dzookeeper.root.logger=INFO,ROLLINGFILE -cp #Thousands of libs...
-Xmx1024m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /usr/hdf/current/zookeeper-server/conf/zoo.cfg
ps: did you set this cluster using the confluent.sh? If so, i made a research at their code and it should exists an directory for zk logs 😞
https://github.com/confluentinc/confluent-cli/blob/master/src/oss/confluent.sh#L414
Or if you prefer, you can try to set it manually, here's my example of log4j.properties for ZK.
[root@node2 ~]# cat /etc/zookeeper/conf/log4j.properties # # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # # # # # ZooKeeper Logging Configuration # # DEFAULT: console appender only log4j.rootLogger=INFO, CONSOLE, ROLLINGFILE # Example with rolling log file #log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE # Example with rolling log file and tracing #log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE # # Log INFO level and above messages to the console # log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.Threshold=INFO log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n # # Add ROLLINGFILE to rootLogger to get log file output # Log DEBUG level and above messages to a log file log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender log4j.appender.ROLLINGFILE.Threshold=DEBUG log4j.appender.ROLLINGFILE.File=/var/log/zookeeper/zookeeper.log # 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 log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n # # Add TRACEFILE to rootLogger to get log file output # Log DEBUG level and above messages to a log file log4j.appender.TRACEFILE=org.apache.log4j.FileAppender log4j.appender.TRACEFILE.Threshold=TRACE log4j.appender.TRACEFILE.File=zookeeper_trace.log log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout ### Notice we are including log4j's NDC here (%x) log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L][%x] - %m%n
And don't forget to fill the zookeeper-env.sh
[root@node2 ~]# cat /etc/zookeeper/conf/zookeeper-env.sh export JAVA_HOME=/usr/jdk64/jdk1.8.0_112 export ZOOKEEPER_HOME=/usr/hdf/current/zookeeper-server export ZOO_LOG_DIR=/var/log/zookeeper export ZOOPIDFILE=/var/run/zookeeper/zookeeper_server.pid export SERVER_JVMFLAGS=-Xmx1024m export JAVA=$JAVA_HOME/bin/java export CLASSPATH=$CLASSPATH:/usr/share/zookeeper/*
Hope this helps!