Skip to content

logback-android and logback-classic ILoggingEvent binary incompatibility getMarkers vs getMarkerList #365

@ulfandersson

Description

@ulfandersson

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.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions