[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-3737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17044673#comment-17044673
 ] 

Christopher Tubbs commented on ZOOKEEPER-3737:
----------------------------------------------

If it's enabled by default in log4j2, it seems ZK could just get rid of it 
entirely in its own code. Just use slf4j as the logging facade, and defer to 
any advanced logging features to the log4j2 implementation (or any alternate 
implementation users select). The less done in code, the more reusable and 
portable the ZK code is.

> Unable to eliminate log4j1 transitive dependency
> ------------------------------------------------
>
>                 Key: ZOOKEEPER-3737
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3737
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: jmx, server
>    Affects Versions: 3.4.14, 3.5.7
>            Reporter: Christopher Tubbs
>            Priority: Major
>
> Apache Accumulo is trying to switch to using log4j2 only. However, this seems 
> impossible, because ZooKeeper has a hard-coded dependency on log4j 1.2 for 
> some sort of jmx thing. The following is the error and stack trace I get 
> whenever I remove log4j 1.2 from the class path and try to run a test 
> instance of ZooKeeper as part of Accumulo's build test suite.
> {code}
> 2020-02-24T20:10:03,682 [jmx.ManagedUtil] ERROR: Problems while registering 
> log4j jmx beans!
> java.lang.ClassNotFoundException: org.apache.log4j.jmx.HierarchyDynamicMBean
>       at 
> jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) 
> ~[?:?]
>       at 
> jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
>  ~[?:?]
>       at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
>       at java.lang.Class.forName0(Native Method) ~[?:?]
>       at java.lang.Class.forName(Class.java:315) ~[?:?]
>       at 
> org.apache.zookeeper.jmx.ManagedUtil.registerLog4jMBeans(ManagedUtil.java:72) 
> ~[zookeeper-3.5.7.jar:3.5.7]
>       at 
> org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:94)
>  ~[zookeeper-3.5.7.jar:3.5.7]
>       at 
> org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:64)
>  ~[zookeeper-3.5.7.jar:3.5.7]
>       at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[?:?]
>       at 
> jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>  ~[?:?]
>       at 
> jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[?:?]
>       at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
>       at org.apache.accumulo.start.Main.lambda$execMainClass$1(Main.java:167) 
> ~[accumulo-start-2.1.0-SNAPSHOT.jar:2.1.0-SNAPSHOT]
>       at java.lang.Thread.run(Thread.java:834) [?:?]
> {code}
> I know previous work has been done on ZOOKEEPER-850 and ZOOKEEPER-1371 to 
> eliminate the use of log4j in the source, but this work does not appear to be 
> complete, since it is still required at runtime (at least, for the server... 
> but maybe for the client too... it's hard to tell from the way Accumulo runs 
> its test suite, and I'm not super familiar with ZK internals).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to