为什么zookeeper不使用我的log4j。属性文件日志目录

时间:2022-06-29 23:13:10

In my zookeeper/conf/log4j.properties file I set the zookeeper.log.dir to $HOME/zklogs

在我的动物园管理员/ conf / log4j。属性文件,我设置zookeeper.log。dir $ HOME / zklogs

When I use zkServer.sh it does not use that directory. Instead it uses the ${ZOO_LOG_DIR} which when I echo it, comes out to "."

当我使用zkServer。它不使用那个目录。相反,它使用${ZOO_LOG_DIR},当我echo它时,它就会出来“。”

I don't understand how fix this issue, I don't see the ${ZOO_LOG_DIR} set anywhere. I am not sure how it gets set to "." at all. I also don't know how to launch zookeeper without zkServer.sh. I am noobish at linux too and a little lost on this issue...

我不知道如何解决这个问题,我没有看到${ZOO_LOG_DIR}设置在任何地方。我不确定它是如何被设置成“。”我也不知道如何在没有zkServer.sh的情况下启动zookeeper。我在linux上也不是很好,在这个问题上有点迷失……

Does anybody know how I can fix this issue so that it uses the directory set in my log4j.properties file in the conf directory?

有谁知道我如何解决这个问题,以便它使用我的log4j中的目录集。在conf目录下的属性文件?

***UPDATE, I found in zkEnv.sh in the bin directory of my zookeeper install. There is code:

***更新,我在zkEnv发现。sh在我的zookeeper安装的bin目录中。有代码:

if["x${ZOO_LOG_DIR}" = "x" ]
then
   ZOO_LOG_DIR="."
fi

I am not sure what is going on in that first line, but it has to be here that something is going wrong. I expect it to look at zookeeper.log.dir from my log4j.properties file. Can anybody tell me if that should be true? I don't want to just hardwire the path here...

我不知道第一行里发生了什么,但一定是出了问题。我希望它能看到zookeeper.log。从我的log4j dir。属性文件。有人能告诉我这是真的吗?我不想在这里硬线…

6 个解决方案

#1


35  

I wanted to add how I fixed this problem / customized my environment.

我想补充一下我是如何解决这个问题的。

There are 2 logging mechanisms working here:

这里有两个日志记录机制:

  • bin/zkServer.sh redirects the zookeeper server's stdout and stderr to zookeeper.out
  • bin / zkServer。将zookeeper服务器的stdout和stderr重定向到zookeeper.out。
  • log4j can append to logs to several places including:
    • CONSOLE - which ends up in zookeeper server's stdout and stderr
    • 控制台-在zookeeper服务器的stdout和stderr中结束。
    • ROLLINGFILE - which is sent to zookeeper.log
    • ROLLINGFILE—发送给zookeeper.log。
  • log4j可以将日志附加到几个地方,包括:控制台——它在zookeeper服务器的stdout和stderr ROLLINGFILE中结束——它被发送到zookeeper.log。

bin/zkServer.sh uses :

bin / zkServer。sh用途:

  • ZOO_LOG_DIR to set the path for both zookeeper.out and log4j.
  • ZOO_LOG_DIR为两个动物管理员设置路径。log4j。
  • ZOO_LOG4J_PROP to set the log4j logging level and what log appenders are turned on
  • ZOO_LOG4J_PROP设置log4j日志级别,并打开了日志appenders。

The "eventual" defaults in the setup conf/log4j.properties are set by a combination of zookeeper bash scripts:

设置conf/log4j中的“最终”默认值。属性设置为zookeeper bash脚本的组合:

  • ZOO_LOG_DIR = . ( the working directory from which zookeeper is started )
    • set inside of conf/log4j.properties as zookeeper.log.dir
    • 设置在conf / log4j。属性作为zookeeper.log.dir
  • ZOO_LOG_DIR =。(zookeeper启动的工作目录)设置在conf/log4j中。属性作为zookeeper.log.dir
  • ZOO_LOG4J_PROP = INFO, CONSOLE
    • set inside of conf/log4j.properties as zookeeper.root.logger
    • 设置在conf / log4j。属性作为zookeeper.root.logger
  • ZOO_LOG4J_PROP = INFO,控制台设置在conf/log4j中。属性作为zookeeper.root.logger

The effect of turning on the log appender CONSOLE is that logs now go to stdout. Because bin/zkServer.sh redirects stdout and stderr to zookeeper.out, log4j logs end up in zookeeper.out. The effect of turning off ROLLINGFILE is that no zookeeper.log file is created.

打开日志appender控制台的效果是,日志现在被输出到stdout。因为bin / zkServer。sh将stdout和stderr重定向到zookeeper。out, log4j log以zookeeper.out结尾。关闭滚动文件的效果是没有管理员。创建日志文件。

The zookeeper.out log is not rotated. The zookeeper.log log is set to be rotated and can be set to expire old logs.

动物园管理员。不旋转日志。动物园管理员。日志日志被设置为旋转,可以设置为过期日志。

I wanted logs to roll and be expired. The first thing I had to do was change conf/log4j.properties to cause the expiration/deletion of old logs. I did that by setting log4j.appender.ROLLINGFILE.MaxBackupIndex inside of conf/log4j.properties. The second thing I had to do was set the log directory, logging level and appenders.

我希望日志能够滚动并过期。我要做的第一件事就是更改conf/log4j。属性导致旧日志的过期/删除。我通过设置log4j.appender.ROLLINGFILE实现了这一点。MaxBackupIndex在conf / log4j . properties。我要做的第二件事是设置日志目录、日志级别和appenders。

I have a bash script that runs every minute. If it sees that zookeeper isn't running, it runs :

我有一个每分钟运行的bash脚本。如果它看到动物园管理员没有跑,它会跑:

bin/zkServer.sh start

I changed it to specify environmental variables expected by bin/zkServer.sh.

我更改了它以指定bin/zkServer.sh所期望的环境变量。

sudo ZOO_LOG_DIR=/opt/zookeeper-3.4.6/logs ZOO_LOG4J_PROP='INFO,ROLLINGFILE' /opt/zookeeper-3.4.6/bin/zkServer.sh start

The effect of turning off the log appender CONSOLE is that log4j logs now no longer end up in zookeeper.out. The effect of turning on ROLLINGFILE is that zookeeper.log file is created, rotated, and expired.

关闭日志appender控制台的效果是log4j日志现在不再以zookeeper.out结束。打开文件的效果就是管理员。创建、旋转和过期日志文件。

BTW, conf/log4j.properties was apparently already in my classpath. I had to make no changes in that regard.

顺便说一句,conf / log4j。属性显然已经在我的类路径中了。在这方面我没有做任何改变。

This chain contributed significantly to my understanding: https://groups.google.com/forum/#!msg/nosql-databases/aebIvNnT0xY/doky1X9-WfwJ

这条链对我的理解有很大帮助:https://groups.google.com/forum/#!msg/nosql-数据库/aebIvNnT0xY/doky1X9-WfwJ。

#2


4  

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.

zkServer。sh从zkEnv获取环境变量。如果是在预期的位置,则env文件设置了包含log4j文件的类路径。

ZOOXFGDIR=ZOOBINDIR/../conf

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.

我在zkServer上放了一些回声。去追踪发生了什么事。我发现类路径被正确设置,但是没有设置logdir和log4j_prop,所以我将它们添加到zkEnv.sh。日志似乎显示在预期的位置。

ZOO_LOG_DIR="/var/log/zookeeper"
ZOO_LOG4J_PROP="INFO,ROLLINGFILE"

#3


2  

As far as I can see from zkEnv.sh zookeeper/conf folder is already in the classpath. There are two problems there:

就我所见,从zkEnv。sh zookeeper/conf文件夹已经在类路径中了。这里有两个问题:

  1. zkServer.sh adds "-Dzookeeper.log.dir=." to ZK launch command unless you specify ZOO_LOG_DIR environment variable
  2. zkServer。除非您指定ZOO_LOG_DIR环境变量,否则要使用ZK启动命令。
  3. even if you do specify ZOO_LOG_DIR, ZK may still be unable to find your log4j.properties file, because zkEnv.sh specifies CLASSPATH like this:

    即使您指定ZOO_LOG_DIR, ZK仍然可能无法找到您的log4j。属性文件,因为zkEnv。sh指定类路径:

    $CLASSPATH="$ZOOCFGDIR:$CLASSPATH"

    $ CLASSPATH =“ZOOCFGDIR:美元类路径”

this works fine if your $CLASSPATH environment variable is not empty, however when it is empty, it just leaves a trailing colon, which screws up your classpath. I changed the lines above to this:

如果您的$CLASSPATH环境变量不是空的,但是当它是空的时,它就会正常工作,它只会留下一个尾随冒号,它会破坏您的类路径。我把上面的线改为:

#add the zoocfg dir to classpath
if [ "x${CLASSPATH}" = "x" ]
then
    CLASSPATH="$ZOOCFGDIR"
else
    CLASSPATH="$ZOOCFGDIR:$CLASSPATH"
fi

and also passed ZOO_LOG_DIR environment for ZK, because zkServer.sh generates -Dzookeeper.log.dir VM argument when starting up ZK. Here is the command that starts ZooKeeper for me, makes it read /opt/zookeeper/conf/log4j.properties and keep log files in /opt/zimbra/log:

还通过ZK传递ZOO_LOG_DIR环境,因为zkServer。sh生成-Dzookeeper.log。在启动ZK时,使用dir VM参数。下面是启动ZooKeeper的命令,让它读/opt/ ZooKeeper /conf/log4j。属性和日志文件在/opt/zimbra/日志:

ZOO_LOG_DIR=/opt/zimbra/log /opt/zookeeper/bin/zkServer.sh start

#4


1  

I believe the answer to my question is that I need to move that log4j.properties file into my classpath and then and only then will zkEnv.sh read of the values that I set in log4j.properties when I call zkServer.sh. I believe I just did not understand how to use log4j properly.

我认为我的问题的答案是我需要移动那个log4j。属性文件进入到我的类路径中,然后才会出现zkEnv。sh读取我在log4j中设置的值。属性当我调用zkServer.sh。我相信我只是不知道如何正确使用log4j。

#5


1  

Another option to change the file log directory via the ZOO_LOG_DIR environment variable is to create your own zk-server-1/conf/zookeeper-env.sh.

通过ZOO_LOG_DIR环境变量更改文件日志目录的另一个选项是创建您自己的zk- server1 /conf/zookeeper-env.sh。

Reading the zookeeper-3.4.6 dist bash scripts(t.i. zkEnv.sh), they source that zookeeper-env.sh file if it exists. Here is it's(my created) content:

阅读zookeeper-3.4.6 dist bash脚本。zkEnv.sh),它们是zookeeper-env的来源。sh文件如果存在。这里是(我创建的)内容:

export ZOO_HOME=$ZOOKEEPER_PREFIX
echo $ZOO_HOME
export ZOO_LOG_DIR=$ZOO_HOME/logs

I am used to having a PRODUCTNAME_HOME variable, which points to the top installation dir of zookeeper. This top dir seems to be named $ZOOKEEPER_PREFIX by zookeeper dist, which i aliase with $ZOO_HOME und use it for the ZOO_LOG_DIR environment variable.

我习惯使用PRODUCTNAME_HOME变量,它指向zookeeper的*安装目录。这个顶部的dir似乎被zookeeper dist命名为$ZOOKEEPER_PREFIX,我使用ZOO_HOME使用它来为ZOO_LOG_DIR环境变量使用它。

At the end of this post i spooled out the bash scripts debug info - helps me investigate which environment or local variables plus values are used.

在这篇文章的结尾,我把bash脚本的调试信息进行了分析——帮助我研究哪些环境或局部变量加上值。

As i see it, the /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf dir is on the CLASSPATH, hence the log4j.properties file is eligible for resource loading via java's class-loader for the log4j framework(which is the way log4j is implemented AFAIR).

如我所见,/home/joma/dev/programme/zk-local- /zk- server1 /bin/。/conf dir在类路径上,因此是log4j。属性文件有资格通过java的类加载器来加载log4j框架(这是log4j实现的方式)。

joma@kopernikus-u:~/dev/programme/zk-local-ensemble$ bash -x zk-server-1/bin/zkServer.sh start
+ '[' x = x ']'
+ JMXLOCALONLY=false
+ '[' x = x ']'
+ echo 'JMX enabled by default'
JMX enabled by default
+ ZOOMAIN='-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain'
+ ZOOBIN=zk-server-1/bin/zkServer.sh
++ dirname zk-server-1/bin/zkServer.sh
+ ZOOBIN=zk-server-1/bin
++ cd zk-server-1/bin
++ pwd
+ ZOOBINDIR=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin
+ '[' -e zk-server-1/bin/../libexec/zkEnv.sh ']'
+ . /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/zkEnv.sh
++ ZOOBINDIR=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin
++ ZOOKEEPER_PREFIX=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/..
++ '[' x = x ']'
++ '[' -e /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf ']'
++ ZOOCFGDIR=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf
++ '[' -f /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zookeeper-env.sh ']'
++ . /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zookeeper-env.sh
+++ export ZOO_HOME=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/..
+++ ZOO_HOME=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/..
+++ echo /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/..
/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/..
+++ export ZOO_LOG_DIR=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs
+++ ZOO_LOG_DIR=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs
++ '[' x = x ']'
++ ZOOCFG=zoo.cfg
++ ZOOCFG=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg
++ '[' -f /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/java.env ']'
++ '[' x/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs = x ']'
++ '[' x = x ']'
++ ZOO_LOG4J_PROP=INFO,CONSOLE
++ '[' /home/joma/entwicklung/programme/jdk1.7.0_51 '!=' '' ']'
++ JAVA=/home/joma/entwicklung/programme/jdk1.7.0_51/bin/java
++ CLASSPATH=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:
++ for i in '"$ZOOBINDIR"/../src/java/lib/*.jar'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ '[' -e '/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../share/zookeeper/zookeeper-*.jar' ']'
++ for i in '"$ZOOBINDIR"/../zookeeper-*.jar'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ LIBPATH=("${ZOOBINDIR}"/../lib/*.jar)
++ for i in '"${LIBPATH[@]}"'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ for i in '"${LIBPATH[@]}"'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ for i in '"${LIBPATH[@]}"'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ for i in '"${LIBPATH[@]}"'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-api-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ for i in '"${LIBPATH[@]}"'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-api-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ for d in '"$ZOOBINDIR"/../build/lib/*.jar'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../build/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-api-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../build/classes:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../build/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-api-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ case "`uname`" in
+++ uname
++ cygwin=false
++ false
+ '[' x '!=' x ']'
+ '[' x '!=' x ']'
++ dirname /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg
+ '[' x/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf '!=' x/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf ']'
+ false
+ KILL=kill
+ echo 'Using config: /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg'
Using config: /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg
+ '[' -z '' ']'
++ grep '^[[:space:]]*dataDir' /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg
++ sed -e 's/.*=//'
+ ZOO_DATADIR=/home/joma/dev/programme/zk-local-ensemble/data/zk1
+ '[' '!' -d /home/joma/dev/programme/zk-local-ensemble/data/zk1 ']'
+ ZOOPIDFILE=/home/joma/dev/programme/zk-local-ensemble/data/zk1/zookeeper_server.pid
+ '[' '!' -w /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs ']'
+ _ZOO_DAEMON_OUT=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs/zookeeper.out
+ case $1 in
+ echo -n 'Starting zookeeper ... '
Starting zookeeper ... + '[' -f /home/joma/dev/programme/zk-local-ensemble/data/zk1/zookeeper_server.pid ']'
+ '[' 0 -eq 0 ']'
+ /bin/echo -n 24744
+ nohup /home/joma/entwicklung/programme/jdk1.7.0_51/bin/java -Dzookeeper.log.dir=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs -Dzookeeper.root.logger=INFO,CONSOLE -cp '/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../build/classes:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../build/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-api-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:' -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg
+ sleep 1
+ echo STARTED
STARTED

#6


0  

Maybe not the sought answer, but for zookeeper-3.4.11 in the conf directory you can set the appropriate levels and configuration in the file log4j.properties

也许不是寻找答案,但是对于conf目录中的zookeeper-3.4.11,您可以在文件log4j.properties中设置适当的级别和配置。

#1


35  

I wanted to add how I fixed this problem / customized my environment.

我想补充一下我是如何解决这个问题的。

There are 2 logging mechanisms working here:

这里有两个日志记录机制:

  • bin/zkServer.sh redirects the zookeeper server's stdout and stderr to zookeeper.out
  • bin / zkServer。将zookeeper服务器的stdout和stderr重定向到zookeeper.out。
  • log4j can append to logs to several places including:
    • CONSOLE - which ends up in zookeeper server's stdout and stderr
    • 控制台-在zookeeper服务器的stdout和stderr中结束。
    • ROLLINGFILE - which is sent to zookeeper.log
    • ROLLINGFILE—发送给zookeeper.log。
  • log4j可以将日志附加到几个地方,包括:控制台——它在zookeeper服务器的stdout和stderr ROLLINGFILE中结束——它被发送到zookeeper.log。

bin/zkServer.sh uses :

bin / zkServer。sh用途:

  • ZOO_LOG_DIR to set the path for both zookeeper.out and log4j.
  • ZOO_LOG_DIR为两个动物管理员设置路径。log4j。
  • ZOO_LOG4J_PROP to set the log4j logging level and what log appenders are turned on
  • ZOO_LOG4J_PROP设置log4j日志级别,并打开了日志appenders。

The "eventual" defaults in the setup conf/log4j.properties are set by a combination of zookeeper bash scripts:

设置conf/log4j中的“最终”默认值。属性设置为zookeeper bash脚本的组合:

  • ZOO_LOG_DIR = . ( the working directory from which zookeeper is started )
    • set inside of conf/log4j.properties as zookeeper.log.dir
    • 设置在conf / log4j。属性作为zookeeper.log.dir
  • ZOO_LOG_DIR =。(zookeeper启动的工作目录)设置在conf/log4j中。属性作为zookeeper.log.dir
  • ZOO_LOG4J_PROP = INFO, CONSOLE
    • set inside of conf/log4j.properties as zookeeper.root.logger
    • 设置在conf / log4j。属性作为zookeeper.root.logger
  • ZOO_LOG4J_PROP = INFO,控制台设置在conf/log4j中。属性作为zookeeper.root.logger

The effect of turning on the log appender CONSOLE is that logs now go to stdout. Because bin/zkServer.sh redirects stdout and stderr to zookeeper.out, log4j logs end up in zookeeper.out. The effect of turning off ROLLINGFILE is that no zookeeper.log file is created.

打开日志appender控制台的效果是,日志现在被输出到stdout。因为bin / zkServer。sh将stdout和stderr重定向到zookeeper。out, log4j log以zookeeper.out结尾。关闭滚动文件的效果是没有管理员。创建日志文件。

The zookeeper.out log is not rotated. The zookeeper.log log is set to be rotated and can be set to expire old logs.

动物园管理员。不旋转日志。动物园管理员。日志日志被设置为旋转,可以设置为过期日志。

I wanted logs to roll and be expired. The first thing I had to do was change conf/log4j.properties to cause the expiration/deletion of old logs. I did that by setting log4j.appender.ROLLINGFILE.MaxBackupIndex inside of conf/log4j.properties. The second thing I had to do was set the log directory, logging level and appenders.

我希望日志能够滚动并过期。我要做的第一件事就是更改conf/log4j。属性导致旧日志的过期/删除。我通过设置log4j.appender.ROLLINGFILE实现了这一点。MaxBackupIndex在conf / log4j . properties。我要做的第二件事是设置日志目录、日志级别和appenders。

I have a bash script that runs every minute. If it sees that zookeeper isn't running, it runs :

我有一个每分钟运行的bash脚本。如果它看到动物园管理员没有跑,它会跑:

bin/zkServer.sh start

I changed it to specify environmental variables expected by bin/zkServer.sh.

我更改了它以指定bin/zkServer.sh所期望的环境变量。

sudo ZOO_LOG_DIR=/opt/zookeeper-3.4.6/logs ZOO_LOG4J_PROP='INFO,ROLLINGFILE' /opt/zookeeper-3.4.6/bin/zkServer.sh start

The effect of turning off the log appender CONSOLE is that log4j logs now no longer end up in zookeeper.out. The effect of turning on ROLLINGFILE is that zookeeper.log file is created, rotated, and expired.

关闭日志appender控制台的效果是log4j日志现在不再以zookeeper.out结束。打开文件的效果就是管理员。创建、旋转和过期日志文件。

BTW, conf/log4j.properties was apparently already in my classpath. I had to make no changes in that regard.

顺便说一句,conf / log4j。属性显然已经在我的类路径中了。在这方面我没有做任何改变。

This chain contributed significantly to my understanding: https://groups.google.com/forum/#!msg/nosql-databases/aebIvNnT0xY/doky1X9-WfwJ

这条链对我的理解有很大帮助:https://groups.google.com/forum/#!msg/nosql-数据库/aebIvNnT0xY/doky1X9-WfwJ。

#2


4  

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.

zkServer。sh从zkEnv获取环境变量。如果是在预期的位置,则env文件设置了包含log4j文件的类路径。

ZOOXFGDIR=ZOOBINDIR/../conf

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.

我在zkServer上放了一些回声。去追踪发生了什么事。我发现类路径被正确设置,但是没有设置logdir和log4j_prop,所以我将它们添加到zkEnv.sh。日志似乎显示在预期的位置。

ZOO_LOG_DIR="/var/log/zookeeper"
ZOO_LOG4J_PROP="INFO,ROLLINGFILE"

#3


2  

As far as I can see from zkEnv.sh zookeeper/conf folder is already in the classpath. There are two problems there:

就我所见,从zkEnv。sh zookeeper/conf文件夹已经在类路径中了。这里有两个问题:

  1. zkServer.sh adds "-Dzookeeper.log.dir=." to ZK launch command unless you specify ZOO_LOG_DIR environment variable
  2. zkServer。除非您指定ZOO_LOG_DIR环境变量,否则要使用ZK启动命令。
  3. even if you do specify ZOO_LOG_DIR, ZK may still be unable to find your log4j.properties file, because zkEnv.sh specifies CLASSPATH like this:

    即使您指定ZOO_LOG_DIR, ZK仍然可能无法找到您的log4j。属性文件,因为zkEnv。sh指定类路径:

    $CLASSPATH="$ZOOCFGDIR:$CLASSPATH"

    $ CLASSPATH =“ZOOCFGDIR:美元类路径”

this works fine if your $CLASSPATH environment variable is not empty, however when it is empty, it just leaves a trailing colon, which screws up your classpath. I changed the lines above to this:

如果您的$CLASSPATH环境变量不是空的,但是当它是空的时,它就会正常工作,它只会留下一个尾随冒号,它会破坏您的类路径。我把上面的线改为:

#add the zoocfg dir to classpath
if [ "x${CLASSPATH}" = "x" ]
then
    CLASSPATH="$ZOOCFGDIR"
else
    CLASSPATH="$ZOOCFGDIR:$CLASSPATH"
fi

and also passed ZOO_LOG_DIR environment for ZK, because zkServer.sh generates -Dzookeeper.log.dir VM argument when starting up ZK. Here is the command that starts ZooKeeper for me, makes it read /opt/zookeeper/conf/log4j.properties and keep log files in /opt/zimbra/log:

还通过ZK传递ZOO_LOG_DIR环境,因为zkServer。sh生成-Dzookeeper.log。在启动ZK时,使用dir VM参数。下面是启动ZooKeeper的命令,让它读/opt/ ZooKeeper /conf/log4j。属性和日志文件在/opt/zimbra/日志:

ZOO_LOG_DIR=/opt/zimbra/log /opt/zookeeper/bin/zkServer.sh start

#4


1  

I believe the answer to my question is that I need to move that log4j.properties file into my classpath and then and only then will zkEnv.sh read of the values that I set in log4j.properties when I call zkServer.sh. I believe I just did not understand how to use log4j properly.

我认为我的问题的答案是我需要移动那个log4j。属性文件进入到我的类路径中,然后才会出现zkEnv。sh读取我在log4j中设置的值。属性当我调用zkServer.sh。我相信我只是不知道如何正确使用log4j。

#5


1  

Another option to change the file log directory via the ZOO_LOG_DIR environment variable is to create your own zk-server-1/conf/zookeeper-env.sh.

通过ZOO_LOG_DIR环境变量更改文件日志目录的另一个选项是创建您自己的zk- server1 /conf/zookeeper-env.sh。

Reading the zookeeper-3.4.6 dist bash scripts(t.i. zkEnv.sh), they source that zookeeper-env.sh file if it exists. Here is it's(my created) content:

阅读zookeeper-3.4.6 dist bash脚本。zkEnv.sh),它们是zookeeper-env的来源。sh文件如果存在。这里是(我创建的)内容:

export ZOO_HOME=$ZOOKEEPER_PREFIX
echo $ZOO_HOME
export ZOO_LOG_DIR=$ZOO_HOME/logs

I am used to having a PRODUCTNAME_HOME variable, which points to the top installation dir of zookeeper. This top dir seems to be named $ZOOKEEPER_PREFIX by zookeeper dist, which i aliase with $ZOO_HOME und use it for the ZOO_LOG_DIR environment variable.

我习惯使用PRODUCTNAME_HOME变量,它指向zookeeper的*安装目录。这个顶部的dir似乎被zookeeper dist命名为$ZOOKEEPER_PREFIX,我使用ZOO_HOME使用它来为ZOO_LOG_DIR环境变量使用它。

At the end of this post i spooled out the bash scripts debug info - helps me investigate which environment or local variables plus values are used.

在这篇文章的结尾,我把bash脚本的调试信息进行了分析——帮助我研究哪些环境或局部变量加上值。

As i see it, the /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf dir is on the CLASSPATH, hence the log4j.properties file is eligible for resource loading via java's class-loader for the log4j framework(which is the way log4j is implemented AFAIR).

如我所见,/home/joma/dev/programme/zk-local- /zk- server1 /bin/。/conf dir在类路径上,因此是log4j。属性文件有资格通过java的类加载器来加载log4j框架(这是log4j实现的方式)。

joma@kopernikus-u:~/dev/programme/zk-local-ensemble$ bash -x zk-server-1/bin/zkServer.sh start
+ '[' x = x ']'
+ JMXLOCALONLY=false
+ '[' x = x ']'
+ echo 'JMX enabled by default'
JMX enabled by default
+ ZOOMAIN='-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain'
+ ZOOBIN=zk-server-1/bin/zkServer.sh
++ dirname zk-server-1/bin/zkServer.sh
+ ZOOBIN=zk-server-1/bin
++ cd zk-server-1/bin
++ pwd
+ ZOOBINDIR=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin
+ '[' -e zk-server-1/bin/../libexec/zkEnv.sh ']'
+ . /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/zkEnv.sh
++ ZOOBINDIR=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin
++ ZOOKEEPER_PREFIX=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/..
++ '[' x = x ']'
++ '[' -e /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf ']'
++ ZOOCFGDIR=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf
++ '[' -f /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zookeeper-env.sh ']'
++ . /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zookeeper-env.sh
+++ export ZOO_HOME=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/..
+++ ZOO_HOME=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/..
+++ echo /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/..
/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/..
+++ export ZOO_LOG_DIR=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs
+++ ZOO_LOG_DIR=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs
++ '[' x = x ']'
++ ZOOCFG=zoo.cfg
++ ZOOCFG=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg
++ '[' -f /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/java.env ']'
++ '[' x/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs = x ']'
++ '[' x = x ']'
++ ZOO_LOG4J_PROP=INFO,CONSOLE
++ '[' /home/joma/entwicklung/programme/jdk1.7.0_51 '!=' '' ']'
++ JAVA=/home/joma/entwicklung/programme/jdk1.7.0_51/bin/java
++ CLASSPATH=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:
++ for i in '"$ZOOBINDIR"/../src/java/lib/*.jar'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ '[' -e '/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../share/zookeeper/zookeeper-*.jar' ']'
++ for i in '"$ZOOBINDIR"/../zookeeper-*.jar'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ LIBPATH=("${ZOOBINDIR}"/../lib/*.jar)
++ for i in '"${LIBPATH[@]}"'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ for i in '"${LIBPATH[@]}"'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ for i in '"${LIBPATH[@]}"'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ for i in '"${LIBPATH[@]}"'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-api-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ for i in '"${LIBPATH[@]}"'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-api-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ for d in '"$ZOOBINDIR"/../build/lib/*.jar'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../build/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-api-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ CLASSPATH='/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../build/classes:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../build/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-api-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:'
++ case "`uname`" in
+++ uname
++ cygwin=false
++ false
+ '[' x '!=' x ']'
+ '[' x '!=' x ']'
++ dirname /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg
+ '[' x/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf '!=' x/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf ']'
+ false
+ KILL=kill
+ echo 'Using config: /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg'
Using config: /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg
+ '[' -z '' ']'
++ grep '^[[:space:]]*dataDir' /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg
++ sed -e 's/.*=//'
+ ZOO_DATADIR=/home/joma/dev/programme/zk-local-ensemble/data/zk1
+ '[' '!' -d /home/joma/dev/programme/zk-local-ensemble/data/zk1 ']'
+ ZOOPIDFILE=/home/joma/dev/programme/zk-local-ensemble/data/zk1/zookeeper_server.pid
+ '[' '!' -w /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs ']'
+ _ZOO_DAEMON_OUT=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs/zookeeper.out
+ case $1 in
+ echo -n 'Starting zookeeper ... '
Starting zookeeper ... + '[' -f /home/joma/dev/programme/zk-local-ensemble/data/zk1/zookeeper_server.pid ']'
+ '[' 0 -eq 0 ']'
+ /bin/echo -n 24744
+ nohup /home/joma/entwicklung/programme/jdk1.7.0_51/bin/java -Dzookeeper.log.dir=/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../logs -Dzookeeper.root.logger=INFO,CONSOLE -cp '/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../build/classes:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../build/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/slf4j-api-1.6.1.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/netty-3.7.0.Final.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/log4j-1.2.16.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../lib/jline-0.9.94.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../zookeeper-3.4.6.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../src/java/lib/*.jar:/home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf:' -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /home/joma/dev/programme/zk-local-ensemble/zk-server-1/bin/../conf/zoo.cfg
+ sleep 1
+ echo STARTED
STARTED

#6


0  

Maybe not the sought answer, but for zookeeper-3.4.11 in the conf directory you can set the appropriate levels and configuration in the file log4j.properties

也许不是寻找答案,但是对于conf目录中的zookeeper-3.4.11,您可以在文件log4j.properties中设置适当的级别和配置。