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

logback-classic 1.4.9 contains breaking change that breaks Play #11907

Closed
felixkrull-neuland opened this issue Aug 7, 2023 · 10 comments · Fixed by #11910
Closed

logback-classic 1.4.9 contains breaking change that breaks Play #11907

felixkrull-neuland opened this issue Aug 7, 2023 · 10 comments · Fixed by #11910
Milestone

Comments

@felixkrull-neuland
Copy link

logback-classic 1.4.9 removed a public method from their API that's used by Play. I haven't looked more closely, but I suspect this version would break any Play app that uses Logback? This is the stacktrace I get from our integration tests:

[error] java.lang.NoSuchMethodError: 'void ch.qos.logback.classic.util.ContextInitializer.configureByResource(java.net.URL)'
[error] 	at play.api.libs.logback.LogbackLoggerConfigurator.configure(LogbackLoggerConfigurator.scala:125)
[error] 	at play.api.libs.logback.LogbackLoggerConfigurator.configure(LogbackLoggerConfigurator.scala:73)
[error] 	at play.api.inject.guice.GuiceApplicationBuilder.$anonfun$configureLoggerFactory$1(GuiceApplicationBuilder.scala:137)
[error] 	at scala.Option.map(Option.scala:242)
[error] 	at play.api.inject.guice.GuiceApplicationBuilder.configureLoggerFactory(GuiceApplicationBuilder.scala:136)
[error] 	at play.api.inject.guice.GuiceApplicationBuilder.applicationModule(GuiceApplicationBuilder.scala:112)
[error] 	at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:201)
[error] 	at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:155)
[...stacktrace continues]

To be clear: this sucks, and IMO they shouldn't do this. But apparently their guidance on this is "just copy the method into your own code". This is the commit that removed the method: qos-ch/logback@4b06e06 Presumably this is the newest version of this code.

Play Version

2.8.19, but likely older as well

API

Scala, but probably either

Operating System

Linux, but probably all OS

JDK

JDK 11 ("Amazon.com Inc. Java 11.0.18"), but probably others as well

Library Dependencies

ch.qos.logback:logback-classic 1.4.9

Expected Behavior

Play doesn't crash on startup and logback logging works.

Actual Behavior

Play crashes on startup. This is the stacktrace when actually running the application:

VM settings:
    Max. Heap Size (Estimated): 10.67G
    Using VM: OpenJDK 64-Bit Server VM

Oops, cannot start the server.
java.lang.NoSuchMethodError: 'void ch.qos.logback.classic.util.ContextInitializer.configureByResource(java.net.URL)'
	at play.api.libs.logback.LogbackLoggerConfigurator.configure(LogbackLoggerConfigurator.scala:125)
	at play.api.libs.logback.LogbackLoggerConfigurator.configure(LogbackLoggerConfigurator.scala:73)
	at play.api.inject.guice.GuiceApplicationBuilder.$anonfun$configureLoggerFactory$1(GuiceApplicationBuilder.scala:137)
	at scala.Option.map(Option.scala:242)
	at play.api.inject.guice.GuiceApplicationBuilder.configureLoggerFactory(GuiceApplicationBuilder.scala:136)
	at play.api.inject.guice.GuiceApplicationBuilder.applicationModule(GuiceApplicationBuilder.scala:112)
	at play.api.inject.guice.GuiceBuilder.injector(GuiceInjectorBuilder.scala:201)
	at play.api.inject.guice.GuiceApplicationBuilder.build(GuiceApplicationBuilder.scala:155)
	at play.api.inject.guice.GuiceApplicationLoader.load(GuiceApplicationLoader.scala:21)
	at play.core.server.ProdServerStart$.start(ProdServerStart.scala:53)
	at play.core.server.ProdServerStart$.main(ProdServerStart.scala:29)
	at play.core.server.ProdServerStart.main(ProdServerStart.scala)
@beikern
Copy link

beikern commented Aug 7, 2023

Can confirm. Play just breaks with the same stack trace that you provided.

@gaeljw
Copy link
Member

gaeljw commented Aug 7, 2023

Having the issue as well.

To be fair, the method was deprecated in logback for some time already.

@iaco86
Copy link

iaco86 commented Aug 7, 2023

This affects also people using logback 1.3.9

@gervaisb
Copy link

gervaisb commented Aug 10, 2023

In case someone wants to know without going to Logback's history (qos-ch/logback@4b06e06), Play is working well with logback 1.4.8

@mkurz
Copy link
Member

mkurz commented Aug 11, 2023

Bites us in playframework/play-samples#383

@mkurz
Copy link
Member

mkurz commented Aug 12, 2023

To be fair, the method was deprecated in logback for some time already.

This method was deprecated with logback PATCH release 1.4.6 (commit) and removed in logback PATCH release 1.4.9 (commit), so I can not support the statement "the method was deprecated in logback for some time already". This is very very bad bad practise from logback IMHO, since it's common practise to not break code and/or remove methods and/or classes in patch releases (except if it is absoluty necessary and unavoidable in case of security bug fixes, but then it should be mentioned in release notes including migration steps).

@mkurz
Copy link
Member

mkurz commented Aug 12, 2023

BTW: Others running in the problem as well, it's definitely not just Play: https://mailman.qos.ch/pipermail/logback-user/2023-August/005288.html

@gaeljw
Copy link
Member

gaeljw commented Aug 12, 2023

Indeed. I only saw it was deprecated and assumed it was for at least 1 minor version. I meant no offense to Play maintainers ;)

@mkurz
Copy link
Member

mkurz commented Aug 12, 2023

😉 Don't worry, just wanted to clarify. Taking a look now at this.

@mkurz
Copy link
Member

mkurz commented Nov 9, 2023

Play 2.8.21 is available which now allows you to upgrade Logback: https://github.com/playframework/playframework/releases/tag/2.8.21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants