-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
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.