-
Notifications
You must be signed in to change notification settings - Fork 157
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
small change to allow pekko-actor-testkit-typed to work with slf4j-api v2 #784
Conversation
Let me pull the repo and try those changes |
Sorry to came back that late. Everything is running fine with your changes, thanks a lot! |
@aaparent in theory, you only need to rebuild the actor-typed-testkit jar. Would you be able to share a test case? I haven't found an existing test that breaks when slf4j V2 is used. |
I think that was due to the way I built the jar (simple publishLocal - not setting a version or whatsoever). It was triggered by : https://github.com/apache/incubator-pekko/blob/main/actor/src/main/scala/org/apache/pekko/util/ManifestInfo.scala#L177 That's why I built all I needed instead of just one jar (setting a version this time). |
try { | ||
Option(evt.getMarker) | ||
} catch { | ||
case _: NoSuchMethodError => None // evt.getMarker was replaced in slf4j v2 with evt.getMarkers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I like the direction of the PR but would it be possible to use reflection to get evt.getMarkers
if it happens to point to the same type as evt.getMarker
(just contained within a list) rather than just doing None
?
That way we could get the best of both worlds.
Now that I think of it, honestly think that we likely should have bumped to slf4j 2 in Pekko 2.0.x series since this is strictly breaking but this may be good enough. Hence I think this calls for a discussion on the Pekko mailing list about whether we should bump libraries that have breaking changes in Pekko minor version bumps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, lgtm
Pekko main branch (future pekko 1.1.0 dev line) already uses slf4j-api v2 and we had to react to a breaking change with the slf4j LoggingEvent getMarker method being replaced with a getMarkers method - see #748
Since testkit is only used in testing, I think we can live with a solution that ignores the Marker on LoggingEvent if the getMarker method is missing.
TestAppender change in #748 is not needed because the ILoggingEvent class still has a getMarker method (just deprecated).
https://logback.qos.ch/apidocs/ch/qos/logback/classic/spi/ILoggingEvent.html