No Commons Logging in Android?

Posted by Joe Boese on Stack Overflow See other posts from Stack Overflow or by Joe Boese
Published on 2010-06-17T04:21:01Z Indexed on 2010/06/17 5:53 UTC
Read the original article Hit count: 470

Filed under:
|
|
|

Hello all, I have a pretty big library I developed specifically for use in my Android Application. However business logic itself has no dependency on Android. To preserve that, I used Commons Logging throughout this library and it's respective JUnit tests (which I run in Eclipse).

However now that I am starting to integrate it into an Activity which I launch on Android, I am unable to get my logging to work. In Eclipse/JUnit, I had simply pulled in log4j's jar file as well as a log4j.properties file. This doesn't seem to work when deploying to a device. After struggling with attempting to get that to work for several hours, I gave up and tried replacing all my commons logging stuff with android.util.Log. Now I can log on the device.. but all JUnit tests are broken. When any JUnit tries to log using android.util.Log, it throws a RuntimeException 'Stub!'.

I would prefer to revert to my commons logging approach.. if anyone can help with that.. otherwise.. what can I do to get my JUnit test cases running using 'android.util.Log'?

Many thanks in advance.. I've spent more than a few hours on this and I'd like to move on to writing real code again!

Joe

© Stack Overflow or respective owner

Related posts about android

Related posts about logging