ijuma commented on a change in pull request #9266: URL: https://github.com/apache/kafka/pull/9266#discussion_r490260948
########## File path: core/src/test/scala/kafka/utils/LoggingTest.scala ########## @@ -58,4 +60,22 @@ class LoggingTest extends Logging { assertEquals(logging.getClass.getName, logging.log.underlying.getName) } + + @Test + def testLoggerLevelIsResolved(): Unit = { + val controller = new Log4jController() + val previousLevel = controller.getLogLevel("kafka") + try { + controller.setLogLevel("kafka", "TRACE") + // Do some logging so that the Logger is created within the hierarchy + // (until loggers are used only loggers in the config file exist) + Logger(LoggerFactory.getLogger("kafka.utils.Log4jControllerTest")).trace("test") + Assert.assertEquals("TRACE", controller.getLogLevel("kafka")) + Assert.assertEquals("TRACE", controller.getLogLevel("kafka.utils.Log4jControllerTest")) + Assert.assertTrue(controller.getLoggers.contains("kafka=TRACE")) + Assert.assertTrue(controller.getLoggers.contains("kafka.utils.Log4jControllerTest=TRACE")) Review comment: Nit: we don't usually include the `Assert.` prefix in test assertions. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org