mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-24 06:47:46 +01:00
This PR enables capturing and printing logs for tests that failed, and is compatible with parallel testing. The core idea is to use a different `LoggerContext` for each test (see [logback's doc on context selection](https://logback.qos.ch/manual/contextSelector.html)). Actual capture and printing of logs is realized through the same technique as Akka's builtin `LogCapture` helpers, that is: - a custom appender accumulates log events in memory - a dedicated logger (defined in logback-test.xml and disabled by default) is manually called by the custom appender when logs need to be printed I unfortunately had to introduce boilerplate classes `MyContextSelector`, `MySlf4jLogger` and `MyCapturingAppender`, the last two being tweaked versions of Akka's existing classes. Note that the log capture is only enabled for tests that use `FixtureSpec`. The `ActorSystem` needs to be configured to log to `MySlf4jLogger`. Advantages over existing technique: - compatible with parallel testing - no funny business with reflection in FixtureSpec.scala - use configuratble logback formatting instead of raw println - allows logging from lightning-kmp (depends on https://github.com/ACINQ/lightning-kmp/pull/355) Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com> |
||
---|---|---|
.. | ||
src | ||
eclair-cli | ||
pom.xml |