Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

log4j support in Android

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?

like image 815
Travis Avatar asked May 26 '10 17:05

Travis


People also ask

Where is Log4j used?

Log4j is everywhere In addition to popular games like Minecraft, it's used in cloud services like Apple iCloud and Amazon Web Services, as well as a wide range of programs from software development tools to security tools.

What is the replacement for Log4j?

SLF4J, Logback, Logstash, Castle Core, and Loki are the most popular alternatives and competitors to Log4j.

Is Log4j thread safe?

Yes, log4j is thread-safe. Log4j components are designed to be used in heavily multithreaded systems.


1 Answers

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:

-- 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.

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.

like image 75
Eran Avatar answered Oct 18 '22 19:10

Eran