十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
log4j如何在Android项目中使用?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:国际域名空间、网络空间、营销软件、网站建设、宿州网站维护、网站推广。Android 使用log4j
前言:
如果要直接在android工程中使用log4j,是有点问题的,会报如下的错:
11-23 09:44:56.947: D/dalvikvm(1585): GC_FOR_MALLOC freed 3278 objects / 311568 bytes in 31ms rejecting opcode 0x21 at 0x000a rejected Lorg/apache/log4j/config/PropertySetter;.getPropertyDescriptor (Ljava/lang/String;)Ljava/beans/PropertyDescriptor; Verifier rejected class Lorg/apache/log4j/config/PropertySetter; Exception Ljava/lang/VerifyError; thrown during Lorg/apache/log4j/LogManager;. Shutting down VM threadid=1: thread exiting with uncaught exception (group=0x400259f8) FATAL EXCEPTION: main java.lang.ExceptionInInitializerError at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:64) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:253) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265) ... Caused by: java.lang.VerifyError: org.apache.log4j.config.PropertySetter at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:772) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:615) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:502) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:547) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:483) at org.apache.log4j.LogManager.(LogManager.java:127) ... 20 more