Skip to content

Commit

Permalink
Fix duplicate SLF4J loggers in tests (#2436)
Browse files Browse the repository at this point in the history
When using a custom logger for log capture in tests (with `akka.loggers=["fr.acinq.eclair.testutils.MySlf4jLogger"]`), we need to explicitly disable the "hardcoded" slf4j logger for akka typed, otherwise we will end up with duplicate slf4j logging (one through our custom logger, the other one through the default slf4j logger).

See the rationale for this hardcoded sl4j logger here: https://doc.akka.io/docs/akka/current/typed/logging.html#event-bus.
  • Loading branch information
pm47 authored Sep 26, 2022
1 parent 1b0ce80 commit 1b36697
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ object FixtureUtils {
s"""| akka {
| logging-context = "$testName"
| loggers = ["fr.acinq.eclair.testutils.MySlf4jLogger"]
| // akka-typed always uses slf4j and by default will remove custom loggers
| use-slf4j = false
| actor.debug.event-stream = off
| }""".stripMargin
}.withFallback(ConfigFactory.load())
Expand Down

0 comments on commit 1b36697

Please sign in to comment.