Android 中的 log4j 支持 [英] log4j support in Android

查看:22
本文介绍了Android 中的 log4j 支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将现有的 SDK 硬塞到 android 设备上,并且所述 SDK 的依赖项之一是 Apache log4j.我能够将我的测试程序加载到 android 模拟器上,但是当调用 log4j 对象PropertySetter"时,程序失败并出现验证异常.有没有办法改善这个问题?

I am attempting to shoehorn an existing SDK onto an android device and one of the dependencies of said SDK is Apache log4j. I am able to load my test program onto the android emulator but when the log4j object "PropertySetter" is called the program fails with a verification exception. Is there a way to ameliorate this issue?

推荐答案

实际上使用 slf4j 对我来说是一个非常轻松的过程,而且这似乎很常见,至少对于使用直接 log4j 功能的库来说是这样.您实际上不需要将 slf4j 换成 log4j,只需将两个 slf4j 库从 http:/添加到您的项目中/www.slf4j.org/download.html:

Actually using slf4j turned out a remarkably painless process for me, and it seems the common case, at least for libraries that use straightforward log4j features. You don't really need to swap slf4j in for log4j, only add two slf4j libraries to your project from http://www.slf4j.org/download.html:

-- Android 的 slf4j 库(目前为 slf4j-android-1.6.1-RC1.jar)
-- slf4j 之上的 log4j (http://www.slf4j.org/legacy.html#log4j-over-slf4j) 桥接器.

-- the slf4j library for Android (currently slf4j-android-1.6.1-RC1.jar)
-- the log4j over slf4j (http://www.slf4j.org/legacy.html#log4j-over-slf4j) bridge.

后者定义了典型实现使用的核心 log4j 类,并将它们绑定到 slf4j Android 实现.添加库后,代码就可以工作了.

The latter defines the core log4j classes used by typical implementations and bind them to the slf4j Android implementation. Once the libraries are added the code works.

这篇关于Android 中的 log4j 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆