newrelic / java-log-extensions

Source for the New Relic Java log framework extensions.
Apache License 2.0
15 stars 22 forks source link

Add support for dropwizard v3+ #97

Open dariocazas opened 2 hours ago

dariocazas commented 2 hours ago

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:

My project now works with dropwizard v4. I can do a compatibility only with these changes:

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+

workato-integration[bot] commented 2 hours ago

https://new-relic.atlassian.net/browse/NR-316584