You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "frankvicky (via GitHub)" <gi...@apache.org> on 2024/10/09 02:38:02 UTC

Re: [PR] KAFKA-8779 Fix flaky tests introduced by dynamic log levels [kafka]

frankvicky commented on code in PR #17382:
URL: https://github.com/apache/kafka/pull/17382#discussion_r1792709057


##########
core/src/test/scala/unit/kafka/utils/TestUtils.scala:
##########
@@ -1865,4 +1866,17 @@ object TestUtils extends Logging {
       timedOut.set(true)
     }
   }
+
+  /**
+   * Resets the logging configuration after the test.
+   */
+  def resetLogging[T] = {
+    org.apache.log4j.LogManager.resetConfiguration()
+    val stream = this.getClass.getResourceAsStream("/log4j.properties")
+    try {
+      PropertyConfigurator.configure(stream)
+    } finally {
+      stream.close()
+    }

Review Comment:
   I wonder we should fix the issue with this workaround at this moment since we are upgrading to log4j2 which providing a convenient way to reload configuration.
   
   https://logging.apache.org/log4j/2.x/javadoc/log4j-core/org/apache/logging/log4j/core/config/Configurator.html#reconfigure()



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org