-
Notifications
You must be signed in to change notification settings - Fork 639
Description
Search before asking
- I had searched in the issues and found no similar issues.
Environment
Other
EventMesh version
master
What happened
Multiple EventMesh artifacts have a runtime dependency on log4j-core (a Log4j API implementation) and log4j-slf4j-impl (an SLF4J implementation), for example eventmesh-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:
- if an application has as runtime dependencies
logback-classicandlog4j-slf4j-impl(both are implementation of SLF4J) only one of them will work, - if an application has as runtime dependencies
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 both logback-classic and log4j-core on its classpath.
To prevent this kind of conflicts, the following steps should be necessary:
- all the logging backends and bridges (an incomplete list:
logback-classic,log4j-core,log4j-to-slf4j,log4j-slf4j-impl,log4j-to-jul,log4j-jul,log4j-over-slf4j) should be removed from theruntimeClasspathand moved to thetestRuntimeOnlyconfiguration, - all
log4j2.xmlconfiguration files should be removed from the published JARs, so that they not interfere with the configuration provided by applications, - the
log4j-core,log4j-slf4j-implandlog4j-julartifacts 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:
./gradlew dependenciesand check the runtimeClasspath configuration.
Debug logs
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct *