问题:在Spark本地模式下初始化SparkContext后,我无法观察到Log4J2的异步功能.
SBT中的Log4j2依赖项:
"com.lmax" % "disruptor" % "3.3.5",
"org.apache.logging.log4j" % "log4j-api" % "2.8.2",
"org.apache.logging.log4j" % "log4j-core" % "2.8.2",
"org.apache.logging.log4j" %% "log4j-api-scala" % "2.8.2"
Log4j2配置文件:
[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
>
[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
he preceding c
我在IntelliJ中设置了以下系统属性
-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
为了测试异步行为,我在初始化SparkContext之前和之后运行了以下代码片段:
val start = System.nanoTime()
for(i
logger.error("Hello")
}
val end = System.nanoTime()