container.followOutput(new Slf4jLogConsumer(org.slf4j.LoggerFactory.getLogger("...")));
container.start();
Observed
Exception in thread "main" java.lang.NullPointerException: containerId was not specified
at org.testcontainers.shaded.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:228)
at com.github.dockerjava.core.command.LogContainerCmdImpl.withContainerId(LogContainerCmdImpl.java:78)
at com.github.dockerjava.core.command.LogContainerCmdImpl.<init>(LogContainerCmdImpl.java:38)
at com.github.dockerjava.core.DockerClientImpl.logContainerCmd(DockerClientImpl.java:364)
at org.testcontainers.dockerclient.AuditLoggingDockerClient.logContainerCmd(AuditLoggingDockerClient.java:23)
at org.testcontainers.utility.LogUtils.attachConsumer(LogUtils.java:88)
at org.testcontainers.utility.LogUtils.followOutput(LogUtils.java:36)
at org.testcontainers.utility.LogUtils.followOutput(LogUtils.java:51)
at org.testcontainers.containers.Container.followOutput(Container.java:391)
Expected
followOutput should accept the log consumer before start() is called.
start() is blocking, so calling followOutput seems like the right way to install the log consumer so it can get logs during startup phase too.
Observed
Expected
followOutputshould accept the log consumer beforestart()is called.start()is blocking, so callingfollowOutputseems like the right way to install the log consumer so it can get logs during startup phase too.