centic9 opened a new issue, #2129: URL: https://github.com/apache/logging-log4j2/issues/2129
## Description When upgrading an Android Application which has a transitive dependency on Log4j from log4j-core 2.21.1 to 2.22.0, it fails with an exception because it seems the method AccessController.doPrivileged() with the required parameters is not available on Android, but calls to it are introduced in LoaderUtil now via commit https://github.com/apache/logging-log4j2/commit/80de81652e0d3eaf195402c2bdc28316a8c71dde This prevents us from upgrading log4j when including any Java libraries which depend on log4j-core in an Android application. Is it possible to not introduce these changes in the 2.x series? The commit-message sounds like this was sort of "let's backport some stuff from 3.x branches". ## Configuration **Version:** 2.22.0 **Operating system:** Android application with min SDK Level 26 **JDK:** Android ## Logs ``` java.lang.NoSuchMethodError: No static method doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;[Ljava/security/Permission;)Ljava/lang/Object; in class Ljava/security/AccessController; or its super classes (declaration of 'java.security.AccessController' appears in /system/framework/core-oj.jar) at org.apache.logging.log4j.util.LoaderUtil.getThreadContextClassLoader(LoaderUtil.java:155) at org.apache.logging.log4j.util.LoaderUtil.findUrlResources(LoaderUtil.java:473) at org.apache.logging.log4j.util.LoaderUtil.findResources(LoaderUtil.java:462) at org.apache.logging.log4j.util.PropertyFilePropertySource.loadPropertiesFile(PropertyFilePropertySource.java:45) at org.apache.logging.log4j.util.PropertyFilePropertySource.<init>(PropertyFilePropertySource.java:37) at org.apache.logging.log4j.util.PropertiesUtil.<init>(PropertiesUtil.java:84) at org.apache.logging.log4j.util.PropertiesUtil.<init>(PropertiesUtil.java:80) at org.apache.logging.log4j.status.StatusLogger.<clinit>(StatusLogger.java:76) at org.apache.logging.log4j.status.StatusLogger.getLogger(StatusLogger.java:149) at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:60) at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:610) at org.dstadler.poiandroidtest.poitest.ApplicationTest.<clinit>(ApplicationTest.java:17) ``` ## Reproduction Can only be reproduced in Android applications using the Emulator. There is a sample Android application "poi-on-android" which shows the issue: * See the following branch for the test-failure with 2.22.0: https://github.com/centic9/poi-on-android/tree/exception_with_log4j_2_22_0 => Fails to run tests via Github Actions, e.g. https://github.com/centic9/poi-on-android/actions/runs/7331541081/job/19964336406 * See the following commit for the same sources except the newer log4j: https://github.com/centic9/poi-on-android/commit/bbea24077589b64bb9a2c6434a4d46a9bd590754 => Successfully runs tests via Github Actions, e.g. https://github.com/centic9/poi-on-android/actions/runs/7331536562/job/19964325253 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
