2

我刚刚将所有 java.util.logging 代码迁移到我的 GAE/J 应用程序中的 log4j 但是我收到了这个错误:

[INFO] Caused by: java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory is a restricted class. Please see the Google  App Engine developer's guide for more details.
[INFO]  at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
[INFO]  at org.apache.logging.log4j.core.appender.rolling.OnStartupTriggeringPolicy.<clinit>(OnStartupTriggeringPolicy.java:33)
[INFO]  at java.lang.Class.forName0(Native Method)
[INFO]  at java.lang.Class.forName(Class.java:186)
[INFO]  at org.apache.logging.log4j.core.config.plugins.PluginManager.decode(PluginManager.java:222

有解决办法吗?

Log4j 的依赖是通过:

    <dependency>
        <groupId>org.apache.onami.logging</groupId>
        <artifactId>org.apache.onami.logging.log4j2</artifactId>
        <version>3.4.0-incubating</version>
    </dependency>
4

1 回答 1

1

您可以通过设置系统属性来禁用 log4j2 中的 JMX log4j2.disable.jmx=true:。 http://logging.apache.org/log4j/2.x/manual/jmx.html

于 2013-06-07T14:24:26.193 回答