testcontainers / testcontainers/testcontainers-java
Easier way to configure logging
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
So by default test containers logs in the following form:
14:42:17.885|INFO |🐳 [gcr.io/etcd-development/etcd:v3.3] - Creating container for image: gcr.io/etcd-development/etcd:v3.3
14:42:18.256|INFO |🐳 [gcr.io/etcd-development/etcd:v3.3] - Starting container with ID: e2f3eb78d0eb6b073271abcf30a76e675fe35f2212684935a36f3a28d4ee9a14
So if I want to log only warning I have to configure i.e. log4j2 as follow:
<Loggers>
<!-- package loggers -->
<Logger name="org.testcontainers" level="INFO" additivity="true"/>
<Logger name="🐳 [gcr.io/etcd-development/etcd:v3.3]" level="WARN" additivity="true"/>
<!-- main logger -->
<Root level="INFO">
<AppenderRef ref="STDOUT" />
</Root>
</Loggers>
Which means that I have to include:
- the bits that generate the docker icon 🐳
- the image name
So if I do upgrade the image or if I need to test against different images, I have to change also the logging configuration if I do not want to see testcontainers logs.
Maybe it is better to put the image name using MDC so one may decide to show it or not.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by locating the Testcontainers logging code and how the image name is included in logger output, then review the existing logging configuration and MDC usage. Done means image-specific logging can be controlled without changing configuration when the image name or image under test changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- observability, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100