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-android and logback-classic ILoggingEvent binary incompatibility getMarkers vs getMarkerList #365

Open
3 tasks done
ulfandersson opened this issue Apr 10, 2024 · 0 comments
Assignees

Comments

@ulfandersson
Copy link

ulfandersson commented Apr 10, 2024

Describe the bug

As stated in the readme, one option for unit tests is to use logback-classic as a replacement for logback-android.

Since the upgrade to sl4j 2.0 (#247) the ILoggingEvent class is no longer binary compatible with logback-classic.

Specifically, and where this matters, is with regards to markers.

logback-android has:
List getMarkers

logback-classic has:
Marker getMarker
List getMarkerList

Reproduction

Call getMarkers() on a ILoggingEvent in a custom encoder (extending EncoderBase<ILoggingEvent>), use this custom encoder from a test where logback-android has been replaced with logback-classic

Example:

class CustomEncoder : EncoderBase<ILoggingEvent>() {
   
    override fun headerBytes(): ByteArray? = null

    override fun footerBytes(): ByteArray? = null

    override fun encode(event: ILoggingEvent): ByteArray {
        return "markers: ${event.markers}".toByteArray()
    }
}

Logs

No response

logback-android version

3.0.0

OS Version

14

What logback configuration are you using? (logback.xml or Java/Kotlin code)

No response

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants