[
https://issues.apache.org/jira/browse/ZOOKEEPER-2342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17479593#comment-17479593
]
Kelvin Do commented on ZOOKEEPER-2342:
--------------------------------------
work for version 3.6.0 and up.
go to lib and remove:
log4j-1.2.17.jar, slf4j-api-1.7.25, slf4j-log4j12-1.7.25.jar
add the flowing to lib
log4j-1.2-api-2.17.0.jar, slf4j-log4j12-1.7.32.jar, log4j-api-2.17.0.jar,
log4j-core-2.17.0.jar, slf4j-api-1.7.32.jar
add log4j2.xml to conf folder
example:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<!-- Console Appender -->
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d\{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level
%logger\{36} - %msg%n" />
</Console>
<!-- Rolling File Appender -->
<RollingFile name="RollingFile">
<FileName>./logs/zookeeper.log</FileName>
<FilePattern>./logs/zookeeper-%d\{yyyy-MM-dd-hh-mm}-%i.log.zip</FilePattern>
<PatternLayout>
<Pattern>%d\{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger\{36} -
%msg%n</Pattern>
</PatternLayout>
<Policies>
<CronTriggeringPolicy schedule="0 0/2 * 1/1 * ? *" />
</Policies>
<DefaultRolloverStrategy max="5" />
</RollingFile>
</Appenders>
<Loggers>
<Logger name="org.apache.zookeeper" level="debug" additivity="false">
<AppenderRef ref="RollingFile" />
<AppenderRef ref="Console" />
</Logger>
<Root level="INFO">
<AppenderRef ref="RollingFile" />
<AppenderRef ref="Console" />
</Root>
</Loggers>
</Configuration>
> Migrate to Log4J 2.
> -------------------
>
> Key: ZOOKEEPER-2342
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2342
> Project: ZooKeeper
> Issue Type: Bug
> Reporter: Chris Nauroth
> Assignee: Chris Nauroth
> Priority: Major
> Fix For: 3.8.0
>
> Attachments: ZOOKEEPER-2342.001.patch
>
>
> ZOOKEEPER-1371 removed our source code dependency on Log4J. It appears that
> this also removed the Log4J SLF4J binding jar from the runtime classpath.
> Without any SLF4J binding jar available on the runtime classpath, it is
> impossible to write logs.
> This JIRA investigated migration to Log4J 2 as a possible path towards
> resolving the bug introduced by ZOOKEEPER-1371. At this point, we know this
> is not feasible short-term. This JIRA remains open to track long-term
> migration to Log4J 2.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)