frankvicky commented on code in PR #17373:
URL: https://github.com/apache/kafka/pull/17373#discussion_r1812297584
##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/LoggersTest.java:
##########
@@ -166,25 +175,32 @@ public void testSetLevel() {
@Test
public void testSetRootLevel() {
- Logger root = logger("root");
- root.setLevel(Level.ERROR);
-
- Logger p = logger("a.b.c.p");
- Logger x = logger("a.b.c.p.X");
- Logger y = logger("a.b.c.p.Y");
- Logger z = logger("a.b.c.p.Z");
- Logger w = logger("a.b.c.s.W");
- x.setLevel(Level.INFO);
- y.setLevel(Level.INFO);
- z.setLevel(Level.INFO);
- w.setLevel(Level.INFO);
+ LoggerContext loggerContext = (LoggerContext)
LogManager.getContext(false);
+ Configuration config = loggerContext.getConfiguration();
+ LoggerConfig rootConfig = new LoggerConfig("", Level.ERROR, false);
+ config.addLogger("", rootConfig);
+ loggerContext.updateLoggers();
+
+ Logger root = LogManager.getLogger("");
Review Comment:
In this test case, we focus on setting the level for the root logger. IMHO,
it would be ideal if we could have a "clean" configuration to conduct this test
case. If I understand correctly, we can create a new configuration
programmatically at the beginning in this way to ensure that the test case is
not affected by existing Log4j configurations.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]