GitHub user ppkarwasz added a comment to the discussion: 
java.lang.IllegalArgumentException: The `GraalVmProcessor` annotation processor 
is missing the required `log4j.graalvm.groupId` and `log4j.graalvm.artifactId` 
options

> Also, we intentionally had `log4j-core` as a `compile` dependency because the 
> code includes a few CLI utilities and on of them was using 
> `Configurator.initialize(...)`. I've now removed this and changed it to a 
> `runtime` dependency.

That’s a common use case—many projects (like Spring Boot and Kafka) use 
`log4j-core` at `compile` scope to modify the logging configuration at runtime.

While `Configurator` is a supported API, it has drawbacks:

* It tightly couples your code to Log4j Core, making backend switching 
difficult. Both Kafka and Spring Boot need to properly isolate this code to 
make `log4j-core` optional.
* It doesn’t handle multiple logger contexts well—only the caller’s context is 
modified.

As I mentioned above we're working on a more flexible, backend-agnostic API in 
[`logging-admin`](https://github.com/apache/logging-admin). It aims to simplify 
configuration tasks and avoid dependency/linkage issues. One open question is 
how to safely support shared logging environments—see apache/logging-admin#1. 
Feedback is welcome!
 
> That said, adding the `log4j-core-test` dependency was not as clean as one 
> would hope. It has a lot of undesirable transitive dependencies (Maven? 
> Spring?). Literally, all I needed was `ListAppender`.
> [...]
> Like I said, I likely missed something; however, it would be great if there 
> were some small/simple artifact with minimal dependencies with the aim of 
> making unit testing logging easier. Unit testing logging likely isn't an 
> ideal thing to do in general but sometimes it's necessary.

You're absolutely right about `log4j-core-test`—it brings in a number of 
unnecessary dependencies for most users. Some of them (like Maven) may no 
longer be needed, while others (like JUnit 4 and Hamcrest) we’ve had to 
manually exclude in certain artifacts.

I’ve opened #3832 to track the idea of publishing a lightweight, dedicated test 
artifact with minimal dependencies. Thanks again for the valuable feedback!




GitHub link: 
https://github.com/apache/logging-log4j2/discussions/3755#discussioncomment-13787333

----
This is an automatically sent email for dev@logging.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@logging.apache.org

Reply via email to