Log Docker output to aid debugging

Add an SLF4J logger so that we can see real time output of the
Docker container.

See gh-29370
pull/29441/head
Phillip Webb 3 years ago
parent 827309f36f
commit 7c16668bf3

@ -23,7 +23,9 @@ import java.util.List;
import java.util.function.Predicate;
import org.assertj.core.api.Condition;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.containers.output.ToStringConsumer;
import org.testcontainers.containers.startupcheck.OneShotStartupCheckStrategy;
import org.testcontainers.images.builder.ImageFromDockerfile;
@ -85,6 +87,7 @@ abstract class AbstractLaunchScriptIntegrationTests {
try (LaunchScriptTestContainer container = new LaunchScriptTestContainer(os, version, this.scriptsDir,
script)) {
container.withLogConsumer(consumer);
container.withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger("docker")));
container.start();
while (container.isRunning()) {
Thread.sleep(100);

@ -52,4 +52,5 @@
<suppress files="StringSequence" checks="SpringMethodVisibility" message="isEmpty"/>
<suppress files="ValidatorPropertiesWithDefaultValues\.java" checks="SpringMethodVisibility" />
<suppress files="DevToolsR2dbcAutoConfigurationTests" checks="HideUtilityClassConstructor" />
<suppress files="AbstractLaunchScriptIntegrationTests" checks="IllegalImport" />
</suppressions>

Loading…
Cancel
Save