Skip to content
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

Dropwizard 4.x (and 5.x) not compatible with Logback core and classic beyond 1.5.12 #1239

Closed
sleberknight opened this issue Jan 4, 2025 · 3 comments · Fixed by #1240
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@sleberknight
Copy link
Member

kiwi-bom 2.0.19 updated logback-classic and logback-core from 1.5.11 to 1.5.15, while the (legacy) logback-access stayed at 1.4.14.

After working through several updates, a bunch of tests started failing in kiwi-test with the following error:

java.lang.Exception: java.lang.AbstractMethodError:
Missing implementation of resolved method 'abstract java.util.Map getDefaultConverterSupplierMap()' 
of abstract class ch.qos.logback.core.pattern.PatternLayoutBase.

The problem started in logback-core 1.5.13, which introduces the following method in ch.qos.logback.core.pattern.PatternLayoutBase:

protected abstract Map<String, Supplier<DynamicConverter>> getDefaultConverterSupplierMap();

This method is not implemented by ch.qos.logback.acces.PatternLayout in logback-access 1.4.14 (since it is a much earlier version).

Even when you update logback-access to 1.5.13 (or higher), ch.qos.logback.access.common.PatternLayout (note the extra 'common' subpackage) still does not implement getDefaultConverterSupplierMap and cannot work.

In addition, Dropwizard 4.x (and 5.x alpha versions as of this writing) has the LogbackAccessRequestLayout class in dropwizard-request-logging, which extends ch.qos.logback.access.PatternLayout (note there is no 'common' package) so it won't work with logback-access 1.5.x anyway.

So, at present until Dropwizard 4.x and 5.x are updated, we cannot go beyond the following versions:

  • logback-access 1.4.14
  • logback-classic 1.5.12
  • logback-core 1.5.12

So, this issue is to revert logback-classic and logback-core to 1.5.12, which is the highest version that still works with logback-access 1.4.14.

@sleberknight sleberknight added the bug Something isn't working label Jan 4, 2025
@sleberknight sleberknight added this to the 2.0.20 milestone Jan 4, 2025
@sleberknight sleberknight self-assigned this Jan 4, 2025
@sleberknight sleberknight changed the title Dropwizard 4.x (and 5.x) not compatible with Logback beyond 1.5.12 Dropwizard 4.x (and 5.x) not compatible with Logback core and classic beyond 1.5.12 Jan 4, 2025
sleberknight added a commit that referenced this issue Jan 4, 2025
This is the highest version of these libraries that we can
use with Dropwizard 4.x (and even the alpha versions of 5.x).
We also must remain on logback-access 1.4.14 or else Dropwizard
code can't work because it depends on the 1.4.x logback-access,
which has a different package than the newer logback-access 2.0.x
versions.

Dropwizard needs to update their usage of Logback classic, core,
and access for us to move beyond these versions. :-(

Fixes #1239
sleberknight added a commit that referenced this issue Jan 7, 2025
Currently, we cannot go beyond logback-core/classic 1.5.12
for the reasons described in #1239 so exclude logback
from the dependabot grouped updates.
sleberknight added a commit that referenced this issue Jan 7, 2025
Currently, we cannot go beyond logback-core/classic 1.5.12
for the reasons described in #1239 so exclude logback
from the dependabot grouped updates.
@sleberknight
Copy link
Member Author

I looked at this again and what basically happened is that logback-core 1.5.13:

  • deprecated getDefaultConverterMap() in PatternLayoutBase
  • added the abstract method getDefaultConverterSupplierMap()

Since getDefaultConverterSupplierMap() is abstract, this breaks all existing implementations. Frankly, this should not have been a patch release, since it breaks any code that extends PatternLayoutBase. But what do I know?

Anyway, the core problem is that Dropwizard's LogbackAccessRequestLayout in dropwizard-request-logging library extends PatternLayoutBase and therefore breaks if you attempt to use any existing version (e.g., 4.0.11) with logback-core 1.5.13 or higher.

@sleberknight
Copy link
Member Author

I think the other problem is that logback-access was split out into a separate repository, and the artifactId was "relocated" from ch.qos.logback:logback-access to ch.qos.logback.access:common and the package names also changed from ch.qos.logback.access to ch.qos.logback.access.common. So, there's clearly a lot going on here and I admit that I don't fully understand what versions are compatible.

The latest ch.qos.logback.access:common version is 2.0.3 and it depends on an older version of logback-core, 1.5.7, so it works fine since the getDefaultConverterSupplierMap() method was introduced in logback-core 1.5.13.

So, the PatternLayout in the relocated logback-access version 2.03 works because it depends on logback-core 1.5.7. This dependency gets updated to logback-core 1.5.9 in 2.0.4, and to 1.5.14 in 2.0.5, and to 1.5.16 in 2.0.6. And version 2.0.5 is where PatternLayout adds an implementation for getDefaultConverterSupplierMap().

But, regardless of all this, Dropwizard is still using the older logback-access, so LogbackAccessRequestLayout in dropwizard-request-logging depends on the PatternLayoutBase under the old package name, ch.qos.logback.access.PatternLayout. As a result, it can not work with the new logback-access 2.0.x versions, since PatternLayoutBase is under the new package name, ch.qos.logback.access.common.

Ok, so after all this meandering, basically we can't fix anything until Dropwizard updates all its logback dependencies. And Dropwizard 4.0.x and the 5.0.0-alpha-N versions are all still using logback version 1.4.14.

@sleberknight
Copy link
Member Author

And perhaps here is the missing piece as to why we are able to use the 1.5.x versions of logback-core and logback-classic:

The 1.5.x series is a direct descendant of and a drop-in replacement for the 1.4.x series. It differs from the 1.4.x series by the relocation of the logback-access module which was moved to its own separate github repository.

ref: On the 1.5.x series in https://logback.qos.ch/news.html

But, after the getDefaultConverterSupplierMap() method was added in logback-core 1.5.13, I think the statement that "The 1.5.x series is a drop-in replacement for the 1.4.x series" no longer holds. And I think this is why we must wait until Dropwizard updates to logback-core/classic 1.5.x and to the relocated logback-access 2.0.x (and updates LogbackAccessRequestLayout i the process).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant