In #94 was discussed a solution to stream log files of a single container to a given Logger. But how can i archieve this with a DockerComposeContainer ? I mean i would like to log the output of each ambassadorContainer. At the moment some of my test which use DockerComposeContainers fail and i would like to see the logs of the container for error analysis.
I tried to implement this by https://github.com/arnzel/testcontainers-java/commit/56c48c748530d7c842930a61d6609a9cb34dd06c but it does not work. Does anyone see why ?
I'm afraid I've not had time to try and run this yet, but what's the problem you're seeing. Is it the problem described in #367?
hi the problem is that i see no logs as the following line in the test expected
waitingConsumer.waitUntil(frame -> frame.getType() == STDOUT && frame.getUtf8String().contains("seq=2"));
It has nothing to do with #367
Add withTailChildContainers(true) to DockerComposeContainer when creating it. Your example also won't override the MariaDb entrypoint (not sure if this is possible with compose), so your assert on the ping output won't work.
In your example you also don't attach the waiting consumer.
Okay thanks for looking on it. i will try it soon
@arnzel Any updates on this? I would like to close the issue if it works for you, or do you think we have to expand the docs in this area?
Hi, currently i have no time to work on it, so it still does not work.
Okay, I'll close this for now since the proposed solution should work. Please notify if this is still an issue for you after applying the proposed changes to your code.
Most helpful comment
Add
withTailChildContainers(true)toDockerComposeContainerwhen creating it. Your example also won't override the MariaDb entrypoint (not sure if this is possible with compose), so your assert on the ping output won't work.In your example you also don't attach the waiting consumer.