添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
魁梧的白开水  ·  R ...·  1 月前    · 
精明的手术刀  ·  Zeiss Apotome 3 at ...·  6 月前    · 
逆袭的饭卡  ·  T-PHOTOSTUDIOS·  1 年前    · 

Recommended logback configuration

Testcontainers, and many of the libraries it uses, utilize SLF4J for logging. In order to see logs from Testcontainers, your project should include an SLF4J implementation (Logback is recommended). The following example logback-test.xml should be included in your classpath to show a reasonable level of log output:

<configuration>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
        </encoder>
    </appender>
    <root level="info">
        <appender-ref ref="STDOUT"/>
    </root>
    <logger name="org.testcontainers" level="INFO"/>
    <!-- The following logger can be used for containers logs since 1.18.0 -->
    <logger name="tc" level="INFO"/>
    <logger name="com.github.dockerjava" level="WARN"/>
    <logger name="com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire" level="OFF"/>
</configuration>

In order to troubleshoot issues with Testcontainers, increase the logging level of org.testcontainers to DEBUG:

<logger name="org.testcontainers" level="DEBUG"/>

Avoid changing the root logger's level to DEBUG, because this turns on debug logging for every package whose level isn't explicitly configured here, resulting in a large amount of log data.