FrankYang0529 commented on code in PR #16601:
URL: https://github.com/apache/kafka/pull/16601#discussion_r1680801404
##########
core/src/test/scala/unit/kafka/admin/AclCommandTest.scala:
##########
@@ -217,17 +217,17 @@ class AclCommandTest extends QuorumTestHarness with
Logging {
createServer(Some(adminClientConfig))
val appender = LogCaptureAppender.createAndRegister()
- val previousLevel =
LogCaptureAppender.setClassLoggerLevel(classOf[AppInfoParser], Level.WARN)
+ appender.setClassLoggerToWarn(classOf[AppInfoParser])
try {
testAclCli(adminArgs)
} finally {
- LogCaptureAppender.setClassLoggerLevel(classOf[AppInfoParser],
previousLevel)
- LogCaptureAppender.unregister(appender)
+ appender.close()
}
- val warning = appender.getMessages.find(e => e.getLevel == Level.WARN &&
- e.getThrowableInformation != null &&
- e.getThrowableInformation.getThrowable.getClass.getName ==
classOf[InstanceAlreadyExistsException].getName)
- assertFalse(warning.isDefined, "There should be no warnings about multiple
registration of mbeans")
+ val warning = appender.getEvents.stream.filter(e => e.getLevel ==
Level.WARN.toString &&
+ e.getThrowableClassName.isPresent &&
Review Comment:
Thanks for the suggestion. Updated it.
--
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]