You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "jakub-id (via GitHub)" <gi...@apache.org> on 2025/08/30 14:10:07 UTC
[I] Do not require java.desktop [logging-log4j2]
jakub-id opened a new issue, #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904
When using log4j2 2.50.0 in a backend vert.x application running on a custom JRE created via `jlink` it's necessary to include the `java.desktop` module otherwise the following exception is thrown during log4j initialization:
```
Exception in thread "main" java.lang.NoClassDefFoundError: java/beans/PropertyChangeEvent
```
Please consider making dependency on java.beans (part of java.desktop) optional or allow exclusion via maven. java.desktop is the second biggest standard module after java.base and it should not be required to include it in backend applications.
--
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-unsubscribe@logging.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3242921486
@jakub-id, I'm confused. You stated
> the problem seems to be a missing release artifact for `log4j-slf4j-impl` `3.0.0-beta-3` release.
> ...
> we already use the [Log4j] BOM:
`log4j-bom:3.x.x` provides `log4j-slf4j-impl:2.x.x`. So where does the `log4j-slf4j-impl:3.0.0-beta-3` dependency come from? Would you mind sharing the `mvn -Dverbose dependency:tree -pl :problematicModule` output, please? (An explanation of how to reproduce the issue will also be helpful.)
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3247857837
> I'm still not following why `log4j-slf4j2-impl` is reverted to `2.24.1` in the `3.0.0-beta3` BOM but that's secondary.
`3.0.0-beta2` was still delivering a `log4j-api` along with all bells and whistles; `log4j-slf4j2-impl`, `log4j-to-slf4j`, `log4j-to-jul`, etc. That is, there was `3.0.0-beta2` version of all these artifacts.
`3.0.0-beta3` removed its own `log4j-api`, `log4j-to-slf4j`, etc. modules and replaced these with dependencies targeting `2.24.1` (the latest `2.x` version of the date) instead. Put another way, `3.0.0-beta3` embraced the _"one and only Log4j API, and that is Log4j 2 API"_ concept. See [release notes](https://logging.apache.org/log4j/3.x/release-notes.html#release-notes-3-0-0-beta3-separate-lifecycle).
> Excluding log4j deps pulled by okapi-core fixed the problems in vert.x
I'm reading this as the issue is resolved. Closing the ticket. Feel free the re-open it and/or drop a comment if you have any further questions/concerns.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3244109283
Bridges such as `log4j-jul`, `log4j-jcl`, and `log4j-slf4j2-impl` don’t depend on a particular Log4j API implementation. They only depend on the API, so we release them alongside `log4j-api`.
That effectively gives us two parallel versioning schemes:
* **`log4j-api` and the bridges** are currently effectively frozen at `2.24.x`. For historical reasons, we’ve kept the `log4j-api` and `log4j-core` 2.x versions in sync, but note that `log4j-api-2.25.x` doesn’t introduce any API changes, for either users or implementors. In fact, I’m deliberately avoiding adding new helper methods so that *all* Log4j API implementations remain compatible with `log4j-api-2.24.0`. In the past, new helpers sometimes caused implementations to break when used with older API versions.
* **`log4j-core` and its extensions** are being released on two tracks: the 2.x line and the new 3.x line.
Unlike SLF4J/Logback, we didn’t establish a separate artifact name for the API vs. the implementation early on. That means we’re “stuck” with the `log4j-api` / `log4j-core` naming, but the underlying principle remains the same.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3239901512
Hi @jakub-id,
Thanks for raising this. We’re aware of the dependency on `PropertyChangeEvent`. Since this class is part of the public API of `LoggerContext`, we couldn’t remove it in the 2.x line without introducing breaking changes.
That’s why the dependency was removed in version 3.x, which now relies only on `java.base` (with an optional dependency on `java.xml`). We’re currently evaluating whether the 3.x line is ready for a stable `3.0.0` release, so it would be very helpful if you could try **`3.0.0-beta3`** and share your feedback. Most of the changes are related to the modularization of the logging implementation: see our [upgrade instructions](https://logging.apache.org/log4j/3.x/migrate-from-log4j2.html) for details.
For context: `PropertyChangeEvent` was introduced into Log4j long before Java 9 and the module system were released.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3242633150
@jakub-id, starting with version `2.24.0`, Log4j API is embraced as the target logging API for both Log4j 2 and Log4j 3. Hence, Log4j 3 does not contain a Log4j API module, but instead implements "the" Log4j API developed in Log4j 2 branch. This ensures Log4j 2 users can safely migrate to Log4j 3 without any Log4j API compatibility concerns. (See [Log4j 3 API docs](https://logging.apache.org/log4j/3.x/manual/api.html).) As a result, Log4j 3 does not ship a separate `log4j-slf4j-impl`, which bridges SLF4J calls to Log4j API, and you can safely use `log4j-slf4j-impl-2.x` in Log4j 3. But we strongly recommend our users to, instead of explicitly providing each artifact version, **use `log4j-bom`** (see [Log4j 3 BOM docs](https://logging.apache.org/log4j/3.x/manual/installation.html#bom)) and leverage the dependencies managed by it.
@jakub-id, would you mind retrying your experiment after importing `log4j-bom` and removing explicit version numbers, please?
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "vietj (via GitHub)" <gi...@apache.org>.
vietj commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3241169527
@ppkarwasz @jakub-id happy to improve vertx to support log4j3, if you could provide more details about the issue so we can determine what is the best option to support this
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "jakub-id (via GitHub)" <gi...@apache.org>.
jakub-id commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3243095342
@vy output of `mvn -Dverbose dependency:tree -pl server` attached for three different versions of log4j2 bom. `beta3` is the only one that pulls `log4j-slf4j-impl:2.24.1`.
[deps-log4j2-1_25_1.log](https://github.com/user-attachments/files/22083094/deps-log4j2-1_25_1.log)
[deps-log4j2-3.0.0-beta2.log](https://github.com/user-attachments/files/22083097/deps-log4j2-3.0.0-beta2.log)
[deps-log4j2-3.0.0-beta3.log](https://github.com/user-attachments/files/22083100/deps-log4j2-3.0.0-beta3.log)
If you can you checkout https://github.com/indexdata/reservoir and run `mvn package -Dlog4j2.version=3.0.0-beta3` it will reproduce the problem in verrt.x.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "jakub-id (via GitHub)" <gi...@apache.org>.
jakub-id commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3242856052
@vy Thanks, we already use the BOM: https://github.com/indexdata/reservoir/blob/0a532333a8c5a1fdd91eaf9136eb64d69a39a193/pom.xml#L50 and we don't use explicit version in the `dependency` section. As, mentioned in the vert.x ticket `3.0.0-beta2` works fine but `3.0.0-beta3` fails. I am not ruling out that we have something wrong in our POM but there's clearly a difference between beta2 and beta3.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3243188784
@jakub-id, `org.folio.okapi:okapi-core` incorrectly drags in `log4j-slf4j2-impl`, excluding that in `server/pom.xml` helped with `ClusterBuilderTest`. There are still some other tests failing, but it has been a long night and I will try to tackle 'em later.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy closed issue #3904: Do not require java.desktop
URL: https://github.com/apache/logging-log4j2/issues/3904
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "jakub-id (via GitHub)" <gi...@apache.org>.
jakub-id commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3242098786
@ppkarwasz @vietj as mentioned on https://github.com/eclipse-vertx/vert.x/issues/5689 the problem seems to be a missing release artifact for `log4j-slf4j-impl` `3.0.0-beta-3` release.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "jakub-id (via GitHub)" <gi...@apache.org>.
jakub-id commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3243102985
@vy it's log4j-bom tht pulls those version, see:
https://central.sonatype.com/artifact/org.apache.logging.log4j/log4j-bom/3.0.0-beta2 -> log4j-slf4j2-impl:3.0.0-beta2
https://central.sonatype.com/artifact/org.apache.logging.log4j/log4j-bom/3.0.0-beta3 -> log4j-slf4j2-impl:2.24.1 (fails in vert.x)
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3253231733
@jakub-id, would you mind creating [a new Discussion](https://github.com/apache/logging-log4j2/discussions/new?category=q-a) for this particular question, please?
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3243150387
> [@vy](https://github.com/vy) it's log4j-bom that pulls those versions, see:
>
> https://central.sonatype.com/artifact/org.apache.logging.log4j/log4j-bom/3.0.0-beta2 -> log4j-slf4j2-impl:3.0.0-beta2 https://central.sonatype.com/artifact/org.apache.logging.log4j/log4j-bom/3.0.0-beta3 -> log4j-slf4j2-impl:2.24.1 (fails in vert.x)
@jakub-id, thanks for confirming that the latest `log4j-bom:3.x.x` indeed pulls in `log4j-slf4j[2]-impl:2.x.x` dependencies as I stated. I will try to reproduce the Log4j 3 and Vert.x problem on `indexdata/reservoir` using the command you shared.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "jakub-id (via GitHub)" <gi...@apache.org>.
jakub-id commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3243893594
@vy Thanks for spotting this, it's only the `test` scope but that's of course exactly what made the tests fail. I've pushed the change and it's passing https://github.com/indexdata/reservoir/pull/39/files. I'm still curious: why are there no `3.0.0-beta3` artifacts for log4j-slf4j and the BOM points back to `2.24.1`?
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3244123795
> I'm still curious: why are there no `3.0.0-beta3` artifacts for log4j-slf4j and the BOM points back to `2.24.1`?
`<ai-assistance>`
Why does Log4j 3 target the old Log4j 2 API?
- **Drop-in replacement** – No code changes, just swap the Log4j Core dependency.
- **Smooth migration** – Avoids the pain of introducing a new API.
- **Ecosystem stability** – Prevents breaking frameworks and libraries.
- **Backend focus** – Log4j 3 improves internals while keeping the API.
**In short:** Log4j 3 = new core, same API — upgrades without disruption.
`</ai-assistance>`
Let me know if this does not answer your question.
@jakub-id, I think, I've made some progress. Would you mind implementing the following changes and reporting back the result, please?
1. In `/pom.xml`, set the `log4j2.version` to `3.0.0-beta3`
2. In `/util/pom.xml`, replace `log4j-slf4j-impl` dependency with `log4j-slf4j2-impl` (Because you're using SLF4J 2)
3. In `/server/pom.xml`, exclude `org.slf4j:jcl-over-slf4j` from `org.apache.solr:solr-solrj`, and add `commons-logging:commons-logging:1.3.5:test` dependency instead (See [Installing JCL-to-Log4j Bridge](https://logging.apache.org/log4j/3.x/manual/installation.html#impl-core-bridge-jcl))
4. In `/server/pom.xml`, replace `log4j-slf4j-impl` dependency with `log4j-slf4j2-impl`
5. In `/server/pom.xml`, exclude `org.apache.logging.log4j:log4j-1.2-api` from `org.folio.okapi:okapi-core` (I suspect a bug in `log4j-1.2-api` here, I will check it later.)
6. In `/client/pom.xml`, replace `log4j-slf4j-impl` dependency with `log4j-slf4j2-impl`
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "jakub-id (via GitHub)" <gi...@apache.org>.
jakub-id commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3239963281
Hi @ppkarwasz,
Thanks, looking forward to 3.0 then. I gave it a shot with our application but vert.x doesn't like it:
```
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: Could not initialize class io.vertx.core.logging.LoggerFactory [in thread "main"]
at io.vertx.core.impl.logging.LoggerFactory.getLogger(LoggerFactory.java:26)
at io.vertx.core.impl.AddressResolver.<clinit>(AddressResolver.java:40)
at io.vertx.core.dns.AddressResolverOptions.<clinit>(AddressResolverOptions.java:94)
at io.vertx.core.VertxOptions.<init>(VertxOptions.java:144)
at io.vertx.core.Vertx.vertx(Vertx.java:141)
```
This is vert.x 4.5.20, we're going to migrate to 5.x in the coming days so I'll give it another try.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3240388736
Hi @jakub-id,
Can you check why the initialization of `io.vertx.core.logging.LoggerFactory` fails? If it is due to some problem in the initialization of `o.a.l.log4j.LogManager`, we are happy to fix it.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "jakub-id (via GitHub)" <gi...@apache.org>.
jakub-id commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3252787902
@vy Thanks, the original issue has been indeed resolved but we have another problem now. One of the dependencies (okapi-core) is using a contextual logger (log4j2 config attached), which on vert.x is not a standard MDC. With beta3 that config fails with:
```
java.lang.IllegalArgumentException
at io.vertx.core.impl.ContextBase.putLocal(ContextBase.java:67)
at io.vertx.core.Context.putLocal(Context.java:289)
at org.folio.okapi.common.logging.FolioLoggingContext.put(FolioLoggingContext.java:107)
at org.folio.tlib.RouterCreator.lambda$mountAll$0(RouterCreator.java:44)
```
this is likely related to a change that removed some defensive code from okapi-core: https://github.com/folio-org/okapi/commit/f1e17983e8b18f932bba86378ad6af9c636bdf8d
Has anything changed wrt handling context variables in 3.x? I skimmed the migration guide but didn't register anything. Any pointers would be appreciated before we get down the rabbit hole again. I'll be happy to create a separate ticket if that's preferred. Thanks in advance.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Do not require java.desktop [logging-log4j2]
Posted by "jakub-id (via GitHub)" <gi...@apache.org>.
jakub-id commented on issue #3904:
URL: https://github.com/apache/logging-log4j2/issues/3904#issuecomment-3246511653
@vy Thanks, I cleaned up logging per your recommendation. Excluding log4j deps pulled by okapi-core fixed the problems in vert.x. I'm still not following why `log4j-slf4j2-impl` is reverted to `2.24.1` in the `3.0.0-beta3` BOM but that's secondary. Thanks again and looking forward to the 3.0.0 GA.
--
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-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org