2014-07-04 53 views
0

我想在Android上使用Log4j2,它會因下列堆棧跟蹤失敗。 Android沒有javax.naming支持,並且我在log4j2中並不需要這個插件。 我該如何禁用Log4j2 JNDI插件? (或任何其他標準插件)如何禁用某些標準的log4j2插件

07-04 11:36:17.088 1573-1573/? E/AndroidRuntime﹕ FATAL EXCEPTION: main 
    java.lang.ExceptionInInitializerError 
      at java.lang.Class.newInstanceImpl(Native Method) 
      at java.lang.Class.newInstance(Class.java:1319) 
      at android.app.Instrumentation.newActivity(Instrumentation.java:1053) 
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974) 
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
      at android.app.ActivityThread.access$600(ActivityThread.java:130) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
      at android.os.Handler.dispatchMessage(Handler.java:99) 
      at android.os.Looper.loop(Looper.java:137) 
      at android.app.ActivityThread.main(ActivityThread.java:4745) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:511) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
      at dalvik.system.NativeStart.main(Native Method) 
    Caused by: java.lang.ExceptionInInitializerError 
      at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:218) 
      at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:144) 
      at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:80) 
      at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:72) 
      at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:37) 
      at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:473) 
      at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:418) 
      at com.altius.epos2.MyActivity.<clinit>(MyActivity.java:17) 
            at java.lang.Class.newInstanceImpl(Native Method) 
            at java.lang.Class.newInstance(Class.java:1319) 
            at android.app.Instrumentation.newActivity(Instrumentation.java:1053) 
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974) 
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
            at android.app.ActivityThread.access$600(ActivityThread.java:130) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
            at android.os.Handler.dispatchMessage(Handler.java:99) 
            at android.os.Looper.loop(Looper.java:137) 
            at android.app.ActivityThread.main(ActivityThread.java:4745) 
            at java.lang.reflect.Method.invokeNative(Native Method) 
            at java.lang.reflect.Method.invoke(Method.java:511) 
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
            at dalvik.system.NativeStart.main(Native Method) 
    Caused by: java.lang.VerifyError: org/apache/logging/log4j/core/lookup/JndiLookup 
      at org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:75) 
      at org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:99) 
      at org.apache.logging.log4j.core.config.NullConfiguration.<init>(NullConfiguration.java:29) 
      at org.apache.logging.log4j.core.LoggerContext.<clinit>(LoggerContext.java:63) 
            at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:218) 
            at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:144) 
            at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:80) 
            at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:72) 
            at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:37) 
            at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:473) 
            at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:418) 
            at com.altius.epos2.MyActivity.<clinit>(MyActivity.java:17) 
            at java.lang.Class.newInstanceImpl(Native Method) 
            at java.lang.Class.newInstance(Class.java:1319) 
            at android.app.Instrumentation.newActivity(Instrumentation.java:1053) 
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974) 
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
            at android.app.ActivityThread.access$600(ActivityThread.java:130) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
            at android.os.Handler.dispatchMessage(Handler.java:99) 
            at android.os.Looper.loop(Looper.java:137) 
            at android.app.ActivityThread.main(ActivityThread.java:4745) 
            at java.lang.reflect.Method.invokeNative(Native Method) 
            at java.lang.reflect.Method.invoke(Method.java:511) 
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
            at dalvik.system.NativeStart.main(Native Method) 

回答

1

您正在使用RC-2?請在log4j2 Jira問題跟蹤器上提出此問題,以便即將發佈2.0版本。