viirya commented on a change in pull request #35095:
URL: https://github.com/apache/spark/pull/35095#discussion_r778297702
##########
File path: core/src/main/scala/org/apache/spark/TestUtils.scala
##########
@@ -418,17 +419,18 @@ private[spark] object TestUtils {
}
/**
- * config a log4j properties used for testsuite
+ * config a log4j2 properties used for testsuite
*/
- def configTestLog4j(level: String): Unit = {
- val pro = new Properties()
- pro.put("log4j.rootLogger", s"$level, console")
- pro.put("log4j.appender.console", "org.apache.log4j.ConsoleAppender")
- pro.put("log4j.appender.console.target", "System.err")
- pro.put("log4j.appender.console.layout", "org.apache.log4j.PatternLayout")
- pro.put("log4j.appender.console.layout.ConversionPattern",
- "%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n")
- PropertyConfigurator.configure(pro)
+ def configTestLog4j2(level: String): Unit = {
+ val builder = ConfigurationBuilderFactory.newConfigurationBuilder()
+ val appenderBuilder = builder.newAppender("console", "CONSOLE")
+ .addAttribute("target", ConsoleAppender.Target.SYSTEM_ERR)
+ appenderBuilder.add(builder.newLayout("PatternLayout")
+ .addAttribute("pattern", "%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n"))
+ builder.add(appenderBuilder)
+
builder.add(builder.newRootLogger(s"$level").add(builder.newAppenderRef("console")))
+ val configuration = builder.build()
+
LogManager.getContext(false).asInstanceOf[LoggerContext].reconfigure(configuration)
Review comment:
Maybe we can just remove `configTestLog4j`?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]