Skip to content

Commit

Permalink
Prevent double logging in tests (#1088)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvanoosten authored Oct 28, 2023
1 parent 9ada445 commit ec6df50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions zio-kafka-test/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<logger name="com.yammer.metrics" level="ERROR"/>
<logger name="kafka" level="ERROR" />

<!-- Some useful loggers to configure while debugging tests: -->
<logger name="zio.kafka" level="INFO" />
<logger name="zio.kafka.consumer.ConsumerSpec" level="INFO" />

<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import zio.test.{ TestAspect, TestAspectAtLeastR, TestEnvironment, ZIOSpecDefaul
*/
abstract class ZIOSpecDefaultSlf4j extends ZIOSpecDefault {

private val loggerLayer = SLF4J.slf4j

override def aspects: Chunk[TestAspectAtLeastR[TestEnvironment]] =
super.aspects :+ TestAspect.fromLayer(zio.Runtime.removeDefaultLoggers >>> SLF4J.slf4j)
super.aspects :+ TestAspect.fromLayer(zio.Runtime.removeDefaultLoggers >>> loggerLayer)

}

0 comments on commit ec6df50

Please sign in to comment.