ppkarwasz commented on issue #3119: URL: https://github.com/apache/logging-log4j2/issues/3119#issuecomment-2439980246
@simmel, Nice catch! Thank you for debugging it this far! From my perspective the issue is caused by an initialization problem of the [`MethodHandleFactory`](https://github.com/openjdk/nashorn/blob/main/src/org.openjdk.nashorn/share/classes/org/openjdk/nashorn/internal/lookup/MethodHandleFactory.java) class: - The initialization of the `MethodHandleFactory` starts by creating an instance of the nested [`StandardMethodHandleFunctionality`](https://github.com/openjdk/nashorn/blob/2eb88e4024023ee8e9baacb7736f914e3aa68aa4/src/org.openjdk.nashorn/share/classes/org/openjdk/nashorn/internal/lookup/MethodHandleFactory.java#L319) class. - The `StandardMethodHandleFunctionality` instance uses static fields and methods of the yet-to-be-initialized `MethodHandleFactory` class. - The usage of these methods and fields is only protected by `DebugLogger.DISABLED_LOGGER.isEnabled()` being `false`. - If you use `log4j-jul`, that method will return `true` and a lot of NPEs will follow. In https://github.com/openjdk/nashorn/pull/19 I proposed a more fool-proof way to check if the `MethodHandleFactory` methods can be used. In the meantime we can add a workaround to Log4j (see https://github.com/apache/logging-log4j2/pull/3125) that will guarantee that the (ineffective) `getLevel()` and `setLevel()` methods return coherent results. This should fix your immediate problem. **PS**: I think that both the above mentioned PRs are just workarounds for a bigger problem: Nashorn tries to modify the logging configuration of your application. I have started a [thread on `nashorn-dev@openjdk`](https://mail.openjdk.org/pipermail/nashorn-dev/2024-October/007687.html) to see if the Nashorn team would be willing to modify that behavior. -- 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: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org