log4j support in Android

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.

Leave a Comment