java-log-extensions
java-log-extensions copied to clipboard
Add support for dropwizard v3+
Is your feature request related to a problem? Please describe.
Upgrading dependencies in one project to avoid vulnerabilities, our transitive dependencies upgrade from dropwizard 1.3 to dropwizard 4. After it, the log extension for dropwizard in this project is not initialised by the META-INF files available in https://github.com/newrelic/java-log-extensions/tree/main/dropwizard/src/main/resources/META-INF/services
Feature Description
We need compatibility for dropwizard logging v4.
Describe Alternatives
Nothing relevant...
Additional context
Code changes
Review the case in deep, we see that between dropwizard v2.1.11 and v3, many changes was doing in dropwizard, but related to code changes, the only affected thing is that the package names of dropwizard changes:
- In v2.1.11, work from
io.dropwizard.logging.XXX
(link) - In v3.0.0, work from
io.dropwizard.logging.common.XXX
(link)
My project now works with dropwizard v4. I can do a compatibility only with these changes:
- Copy the code from this repository in module
dropwizard
(and some transitive classes outside) - Change the
import
in the different classes to the commented new package name - Rename the files in META-INF/services folder
-
io.dropwizard.logging.common.AppenderFactory
-
io.dropwizard.logging.common.layout.DiscoverableLayoutFactory
-
With this few changes, our log traces was enriched again :)
I was going to do a PR with this changes... but found the next related point: Java version :(
Java version
The current java-log-extensions project has enforced to run Java 8.
If you pass from dropwizard v2.1.11 until v3.0.0, the build fail due to some transitive dependencies requires Java 11.
Issue details
I create in local over java-log-extensions a module called dropwizard3 with the content of the current dropwizard only changing the dependency version to dropwizard. Next, when run a build (using Java 8):
$ ./gradlew :dropwizard3:build
> Task :dropwizard3:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dropwizard3:compileJava'.
> Could not resolve all files for configuration ':dropwizard3:compileClasspath'.
> Could not resolve com.github.ben-manes.caffeine:caffeine:3.1.8.
Required by:
project :dropwizard3 > io.dropwizard:dropwizard-logging:3.0.8 > io.dropwizard:dropwizard-jackson:3.0.8
> No matching variant of com.github.ben-manes.caffeine:caffeine:3.1.8 was found. The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but:
- Variant 'apiElements' capability com.github.ben-manes.caffeine:caffeine:3.1.8 declares an API of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'javadocElements' capability com.github.ben-manes.caffeine:caffeine:3.1.8 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Variant 'runtimeElements' capability com.github.ben-manes.caffeine:caffeine:3.1.8 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Variant 'sourcesElements' capability com.github.ben-manes.caffeine:caffeine:3.1.8 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them preferably in the form of class files)
At this point, I stop working in a possible PR, due first this project probably requires upgrade the Java compatibility version.
Priority
Today I'm working with a copy of the current code inside of my project with the required changes: we can live with this for now, but the proper action is using a dependency and follow his upgrades.
By other hand, probably many teams need compatibility with dropwizard v3+