Android 中的 log4j 支持

log4j support in Android(Android 中的 log4j 支持)
本文介绍了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 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)