Testcontainers run with noisy DEBUG logs everywhere. I tried to silence them with

logging:
  level:
    com.github.dockerjava: INFO
    org.testcontainers: INFO

but somehow it is not honoured. I would be tempted to think that the docker magic testcontainer is not binded as usual logs since they run inside container, but logback-test.xml is honoured if present in the classpath of the spring-boot app, and also this ticket prove that at some point, logger.level directives worked: https://github.com/testcontainers/testcontainers-java/issues/43#issuecomment-170801176

Could it be that we have a problem on initialisation order so the testcontainer logic happens before the logging system sets up?

Comment From: mbhave

I think this is related to the order in which JUnit5 extension callbacks are handled. The log levels won't be set until SpringExtension's postProcessTestInstance is called. This happens after the beforeAll() callback in TestContainerExtension which is where the container is started, from what I can tell. I think the recommended way is to use logback-test.xml. This is what's used in the examples as well.

I'll leave the issue open in case the team thinks otherwise.

Comment From: wilkinsona

I agree with @mbhave. This is an unavoidable ordering problem. A logback-test.xml is the way to go.

The Testcontainers issue is from 2016 which predates the release of JUnit 5 so it must be using a different test framework.