-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add docker. prefix to container logger names, to enable log level to be set across all loggers
#3018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docker. prefix to container logger names, to enable log level to be set across all loggers
#3018
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||
| package org.testcontainers.utility; | ||||||
|
|
||||||
| import ch.qos.logback.classic.Level; | ||||||
| import ch.qos.logback.classic.Logger; | ||||||
| import ch.qos.logback.classic.spi.ILoggingEvent; | ||||||
| import ch.qos.logback.core.read.ListAppender; | ||||||
| import org.junit.Test; | ||||||
|
|
||||||
| import static org.assertj.core.api.Assertions.assertThat; | ||||||
|
|
||||||
| public class DockerLoggerFactoryTest { | ||||||
|
|
||||||
| private static final Logger LOGGER = (Logger) DockerLoggerFactory.getLogger("dockerImageName"); | ||||||
|
|
||||||
| @Test | ||||||
| public void debugIsNotSwallowedForContainerLogs() { | ||||||
| // Arrange | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ListAppender<ILoggingEvent> listAppender = new ListAppender<>(); | ||||||
| listAppender.start(); | ||||||
| LOGGER.addAppender(listAppender); | ||||||
|
|
||||||
| // Act | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| LOGGER.debug("some text"); | ||||||
|
|
||||||
| // Assert | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| assertThat(listAppender.list).withFailMessage("Log message has been swallowed").hasSize(1); | ||||||
|
|
||||||
| ILoggingEvent event = listAppender.list.get(0); | ||||||
|
|
||||||
| assertThat(event.getFormattedMessage()).isEqualTo("some text"); | ||||||
| assertThat(event.getLevel()).isEqualTo(Level.DEBUG); | ||||||
| assertThat(event.getLoggerName()).startsWith("org.testcontainers.docker"); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,4 +15,4 @@ | |
| <logger name="org.testcontainers" level="DEBUG"/> | ||
| <logger name="org.testcontainers.shaded" level="WARN"/> | ||
|
|
||
| </configuration> | ||
| </configuration> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we rollback this, please? |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.