use slf4j v2 (#748)

* use slf4j v2

* Update StubbedActorContext.scala

* deprecation warning

* Update TestAppender.scala
This commit is contained in:
PJ Fanning 2023-10-18 23:16:42 +01:00 committed by GitHub
parent c5611ec0d8
commit 5a45fdf734
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View file

@ -21,7 +21,7 @@ import pekko.actor.{ ActorPath, ActorRefProvider, InvalidMessageException }
import pekko.annotation.InternalApi
import pekko.util.Helpers
import pekko.{ actor => classic }
import org.slf4j.Logger
import org.slf4j.{ Logger, Marker }
import org.slf4j.helpers.{ MessageFormatter, SubstituteLoggerFactory }
import java.util.concurrent.ThreadLocalRandom.{ current => rnd }
@ -243,11 +243,15 @@ private[pekko] final class FunctionRef[-T](override val path: ActorPath, send: (
.iterator()
.asScala
.map { evt =>
CapturedLogEvent(
level = evt.getLevel,
message = MessageFormatter.arrayFormat(evt.getMessage, evt.getArgumentArray).getMessage,
cause = Option(evt.getThrowable),
marker = Option(evt.getMarker))
{
val marker: Option[Marker] = Option(evt.getMarkers).flatMap(_.asScala.headOption)
CapturedLogEvent(
level = evt.getLevel,
message = MessageFormatter.arrayFormat(evt.getMessage, evt.getArgumentArray).getMessage,
cause = Option(evt.getThrowable),
marker = marker)
}
}
.toList
}

View file

@ -16,6 +16,7 @@ package org.apache.pekko.actor.testkit.typed.internal
import ch.qos.logback.classic.spi.ILoggingEvent
import ch.qos.logback.classic.spi.ThrowableProxy
import ch.qos.logback.core.AppenderBase
import org.slf4j.Marker
import org.apache.pekko
import pekko.actor.testkit.typed.LoggingEvent
@ -88,13 +89,14 @@ import pekko.annotation.InternalApi
case _ => None
}
val marker: Option[Marker] = Option(event.getMarkerList).flatMap(_.asScala.headOption)
val loggingEvent = LoggingEvent(
level = convertLevel(event.getLevel),
message = event.getFormattedMessage,
loggerName = event.getLoggerName,
threadName = event.getThreadName,
timeStamp = event.getTimeStamp,
marker = Option(event.getMarker),
marker = marker,
throwable = throwable,
mdc = event.getMDCPropertyMap.asScala.toMap)

View file

@ -22,7 +22,7 @@ object Dependencies {
.withRank(KeyRanks.Invisible) // avoid 'unused key' warning
val junitVersion = "4.13.2"
val slf4jVersion = "1.7.36"
val slf4jVersion = "2.0.9"
// check agrona version when updating this
val aeronVersion = "1.42.1"
// needs to be inline with the aeron version, check
@ -30,7 +30,7 @@ object Dependencies {
val agronaVersion = "1.19.2"
val nettyVersion = "4.1.100.Final"
val protobufJavaVersion = "3.19.6"
val logbackVersion = "1.2.12"
val logbackVersion = "1.3.11"
val jacksonCoreVersion = "2.14.3"
val jacksonDatabindVersion = jacksonCoreVersion