Skip to content

Commit

Permalink
use slf4j v2 (#748)
Browse files Browse the repository at this point in the history
* use slf4j v2

* Update StubbedActorContext.scala

* deprecation warning

* Update TestAppender.scala
  • Loading branch information
pjfanning authored Oct 18, 2023
1 parent c5611ec commit 5a45fdf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ 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
// https://github.com/real-logic/aeron/blob/1.x.y/build.gradle
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
Expand Down

0 comments on commit 5a45fdf

Please sign in to comment.