We are getting Jira issues about getting log4j to work in Android. At first, all I thought was required was getting the API to function on top of Android’s logging system. However, it seems that there are some who want to use the RollingFileAppender or perhaps other appenders. The issue I have is that I am pretty sure there are other things inside core that won’t work in Android, which was why my first attempt was to just get the API working there.
Right now there are 8 open issues that mention Android. LOG4J2-1915, LOG4J2-1920 LOG4J2-1921 all say that 2.8.2 doesn’t work, which was before the Java 9 support was added. LOG4J2-2042 says 2.9 doesn’t work because of a dependency on java.lang.management classes. LOG4J2-1920 says it has an error because the ScriptEngineManager is not available.
I am not sure how to solve this. We could just say Android is not supported although that would likely cause problems for a lot of people. We could only support API integration, as I first tried to do, We could put in a bunch of code to try to detect android and disable stuff that doesn’t work there, but that is quite a bit of work and as far as I can tell none of the committers work with Android. Finally, we could create a log4j-android that contains the API combined with a minimal version of core.
Any thoughts on this?