-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Maven artifacts should not depend on logging backend #4700
Comments
Welcome to the Apache EventMesh community!! Please make sure to include all the relevant context. If you are interested in contributing to our project, please let us know! Want to get closer to the community?
Mailing Lists:
|
Thank you for pointing it out! Usually third-party applications will depend on eventmesh-sdk (cf. https://github.com/apache/eventmesh/blob/master/eventmesh-sdks/eventmesh-sdk-java/build.gradle), only |
This PR removes all the logging backends from the Maven artifacts. As explained in apache#4700 libraries should only depend on logging APIs, not logging implementations the same way web applications depend on the Servlet API, not its implementations. The logging backends are added to the `dist` folder to be included in the TAR binary distribution.
This PR removes all the logging backends from the Maven artifacts. As explained in apache#4700 libraries should only depend on logging APIs, not logging implementations the same way web applications depend on the Servlet API, not its implementations. The logging backends are added to the `dist` folder to be included in the TAR binary distribution.
* [ISSUE #4700] Remove logging backends from runtime deps This PR removes all the logging backends from the Maven artifacts. As explained in #4700 libraries should only depend on logging APIs, not logging implementations the same way web applications depend on the Servlet API, not its implementations. The logging backends are added to the `dist` folder to be included in the TAR binary distribution. * Fix licenses * Fix Logback exclusions * Fix license check * Fix `printProjects` according to the review * Add logging backend to `eventmesh-starter` * Remove task description * Fix task dependencies of task `installPlugin` * Fix `installPlugin` task * Add comment about exclusions * Minimize changes to current configuration This commit minimizes the changes to EventMesh dependencies. Since a global exclusion is not an effective way to stop propagating logging backends as **transitive** dependencies we: * explictly remove logging backends from third-party dependencies that include them: RocketMQ, Pulsar, Spring Boot and Zookeeper, * restore Log4j Core as dependency of `eventmesh-common`, * exclude Log4j Core as dependency of `eventmesh-sdk-java`. * Add comments to remove exclusions after upgrade * Make `installPlugin` independent from `dist` * Make `copy` tasks easier to understand * Add `eventmesh-common` to EventMesh OpenConnect deps * Refactor RocketMQ deps * Delete `output.dirs` * Fix typo * Remove last `outputs.dir` * Remove dependencies from `installPlugin` * Add `eventmesh-common` to OpenConnect artifacts
Search before asking
Environment
Other
EventMesh version
master
What happened
Multiple EventMesh artifacts have a runtime dependency on
log4j-core
(a Log4j API implementation) andlog4j-slf4j-impl
(an SLF4J implementation), for exampleeventmesh-common
. These can cause problems to applications that depend on EventMesh artifacts, but use a different logging backend.Unlike logging APIs (e.g.
slf4j-api
,log4j-api
,commons-logging
, etc.) that can coexist within the same application, logging backends and bridges (e.g.logback-classic
,log4j-core
,log4j-to-slf4j
,log4j-slf4j-impl
, etc.) are mutually exclusive. A couple of examples:logback-classic
andlog4j-slf4j-impl
(both are implementation of SLF4J) only one of them will work,log4j-to-slf4j
(a bridge from Log4j API to SLF4J) andlog4j-slf4j-impl
(a bridge from SLF4J to Log4j API), both of them will cease to work to prevent an infinite loop.It is easy to find such examples in practice: an application based both on
zookeper
and EventMesh, will have bothlogback-classic
andlog4j-core
on its classpath.To prevent this kind of conflicts, the following steps should be necessary:
logback-classic
,log4j-core
,log4j-to-slf4j
,log4j-slf4j-impl
,log4j-to-jul
,log4j-jul
,log4j-over-slf4j
) should be removed from theruntimeClasspath
and moved to thetestRuntimeOnly
configuration,log4j2.xml
configuration files should be removed from the published JARs, so that they not interfere with the configuration provided by applications,log4j-core
,log4j-slf4j-impl
andlog4j-jul
artifacts should be added to the TAR distribution, since it is meant to run as a standalone application.How to reproduce
To pinpoint the affected artifacts run:
and check the
runtimeClasspath
configuration.Debug logs
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: