Support Questions

Find answers, ask questions, and share your expertise

Zookeeper 3.8.4 not logging

avatar
New Contributor

Hello 

I'm running apache zookeeper 3.8.4.
File zookeeper.log does not get created.
Log files are empty except the following message:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
SLF4J: Failed to load class "org.slf4j.impl.StaticMDCBinder".
SLF4J: Defaulting to no-operation MDCAdapter implementation.
SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further details.

How can I configure zookeeper with logs working ?

According to the links, this is due to slf4j not detecting logback.

The process runs with the following options in the commandline (extract)
The classpath does seem to include slf4j and logback jars, 
as well as the conf directory containing logback.xml

/apps/dis/java/jdk/bin/java
-Dzookeeper.log.dir=/apps/zookeeper/log
-Dzookeeper.log.file=zookeeper.log
-cp
...
/apps/zookeeper/bin/zkcurrent/bin/../lib/slf4j-api-1.7.30.jar:
...
/apps/zookeeper/bin/zkcurrent/bin/../lib/logback-core-1.2.13.jar:
...
/apps/zookeeper/bin/zkcurrent/bin/../lib/logback-classic-1.2.13.jar:
/apps/zookeeper/bin/zkcurrent/bin/../conf:
...
org.apache.zookeeper.server.quorum.QuorumPeerMain
/apps/zookeeper/bin/zkcurrent/bin/../conf/zoo.cfg

The logback.xml file is in 
/apps/zookeeper/bin/zkcurrent/bin/../conf
with rollingfile and console appenders activated:

<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>${zookeeper.console.threshold}</level>
</filter>
</appender>

...
<appender name="ROLLINGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${zookeeper.log.dir}/${zookeeper.log.file}</File>
<encoder>
<pattern>%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>${zookeeper.log.threshold}</level>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<maxIndex>${zookeeper.log.maxbackupindex}</maxIndex>
<FileNamePattern>${zookeeper.log.dir}/${zookeeper.log.file}.%i</FileNamePattern>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>${zookeeper.log.maxfilesize}</MaxFileSize>
</triggeringPolicy>
</appender>

...

<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="ROLLINGFILE" />
</root>

All suggestions welcome.

Regards

1 REPLY 1

avatar
Master Mentor

@Alf015 
Can you share in what context  standalone? Package with HDP or CDP etc. This will give a better understanding on maybe how to replicate your environment and enable us to help resolve your issue.

Thank you