GridGain日志记录配置问题

时间:2014-04-04 17:04:14

标签: log4j gridgain

我开始玩GridGain(祝贺开源吧!)

我正在尝试将其嵌入到另一个应用程序中,因此我需要使用JCL日志记录而不是Log4j。

我的简单代码如下所示(是的,它是groovy代码):

    def cfg = new GridConfiguration()
    cfg.setGridLogger( new GridJclLogger() )
    cfg.setLifecycleBeans(new DaemonLifecycleBean())
    def grid = GridGain.start(cfg); 

但我在下面得到了例外。如果我配置JCL日志记录,为什么会抱怨丢失Log4j?

Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/varia/LevelRangeFilter
    at org.gridgain.grid.kernal.GridKernal.createNodeAttributes(GridKernal.java:1187) ~[gridgain-platform-6.0.2.jar:na]
    at org.gridgain.grid.kernal.GridKernal.start(GridKernal.java:608) ~[gridgain-platform-6.0.2.jar:na]
    at org.gridgain.grid.kernal.GridGainEx$GridNamedInstance.start0(GridGainEx.java:1828) ~[gridgain-platform-6.0.2.jar:na]
    ... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.varia.LevelRangeFilter
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0_51]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_51]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_51]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_51]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[na:1.7.0_51]

1 个答案:

答案 0 :(得分:1)

目前GridGain对log4j有明确的依赖关系,因此你需要在节点类路径中保留log4j类。

此依赖项将在即将发布的版本中删除,然后您将能够使用JCL记录器运行该节点,而无需在类路径中使用log4j。