j256 / cloudwatch-logback-appender

Appender that publishes logback log entries to AWS CloudWatch
ISC License
56 stars 37 forks source link

Exception thrown: java.lang.NoSuchMethodError: 'void ch.qos.logback.classic.spi.LoggingEvent.setMarker(org.slf4j.Marker) #50

Closed Sokrim closed 1 year ago

Sokrim commented 1 year ago

cloudwatchlogappender's latest version does not work with the latest versions of logback/slf4j

Dependencies:

  <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>2.0.4</version>
    </dependency>
    <dependency>
        <groupId>com.j256.cloudwatchlogbackappender</groupId>
        <artifactId>cloudwatchlogbackappender</artifactId>
        <version>2.1</version>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.4.5</version>
    </dependency>

Error Logs:

Exception in thread "main" java.lang.NoSuchMethodError: 'void ch.qos.logback.classic.spi.LoggingEvent.setMarker(org.slf4j.Marker)'

at com.j256.cloudwatchlogbackappender.CloudWatchAppender.copyEvent(CloudWatchAppender.java:410)
at com.j256.cloudwatchlogbackappender.CloudWatchAppender.append(CloudWatchAppender.java:218)
at com.j256.cloudwatchlogbackappender.CloudWatchAppender.append(CloudWatchAppender.java:60)
at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:85)
at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:272)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:259)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:426)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:386)
at ch.qos.logback.classic.Logger.info(Logger.java:584)
at org.example.App.doLogs(App.java:17)
at org.example.App.main(App.java:13)
j256 commented 1 year ago

Should be ifxed by #51. Thanks @Sokrim .

swalendzik commented 1 year ago

@j256 can you release library with upgraded logback ?

anoopnarang commented 7 months ago

@j256 This fix is not released yet. Getting the same error with latest version 2.1

richard-browne commented 6 months ago

Still not fixed. Not sure why this issue is closed. cloudwatch-logback-appender doesn't work with logback 1.4 or later.