[ https://issues.apache.org/jira/browse/SPARK-37746?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chia-Ping Tsai updated SPARK-37746: ----------------------------------- Description: the code used to check initialization is shown below. val log4j2Initialized = !LogManager.getRootLogger .asInstanceOf[org.apache.logging.log4j.core.Logger].getAppenders.isEmpty That works for log4j. However, log4j2 provides a default configuration so there is always a appender (ConsoleAppender) with error level. reference from [https://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticConfiguration] Log4j will provide a default configuration if it cannot locate a configuration file. The default configuration, provided in the DefaultConfiguration class, will set up: * A [ConsoleAppender|https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/appender/ConsoleAppender.html] attached to the root logger. * A [PatternLayout|https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/layout/PatternLayout.html] set to the pattern "%d\{HH:mm:ss.SSS} [%t] %-5level %logger\{36} - %msg%n" attached to the ConsoleAppender Note that by default Log4j assigns the root logger to Level.ERROR. was: the code used to check initialization is shown below. val log4j2Initialized = !LogManager.getRootLogger .asInstanceOf[org.apache.logging.log4j.core.Logger].getAppenders.isEmpty That works for log4j. However, log4j2 provides a default configuration so there is always a appender (ConsoleAppender) with error level. according to [https://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticConfiguration] Log4j will provide a default configuration if it cannot locate a configuration file. The default configuration, provided in the DefaultConfiguration class, will set up: * A [ConsoleAppender|https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/appender/ConsoleAppender.html] attached to the root logger. * A [PatternLayout|https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/layout/PatternLayout.html] set to the pattern "%d\{HH:mm:ss.SSS} [%t] %-5level %logger\{36} - %msg%n" attached to the ConsoleAppender Note that by default Log4j assigns the root logger to Level.ERROR. > log4j2-defaults.properties is not working since log4j 2 is always initialized > by default > ---------------------------------------------------------------------------------------- > > Key: SPARK-37746 > URL: https://issues.apache.org/jira/browse/SPARK-37746 > Project: Spark > Issue Type: Bug > Components: Spark Core > Affects Versions: 3.3.0 > Reporter: Chia-Ping Tsai > Priority: Minor > > the code used to check initialization is shown below. > val log4j2Initialized = !LogManager.getRootLogger > > .asInstanceOf[org.apache.logging.log4j.core.Logger].getAppenders.isEmpty > That works for log4j. However, log4j2 provides a default configuration so > there is always a appender (ConsoleAppender) with error level. > > reference from > [https://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticConfiguration] > Log4j will provide a default configuration if it cannot locate a > configuration file. The default configuration, provided in the > DefaultConfiguration class, will set up: > * A > [ConsoleAppender|https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/appender/ConsoleAppender.html] > attached to the root logger. > * A > [PatternLayout|https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/layout/PatternLayout.html] > set to the pattern "%d\{HH:mm:ss.SSS} [%t] %-5level %logger\{36} - %msg%n" > attached to the ConsoleAppender > Note that by default Log4j assigns the root logger to Level.ERROR. > > > -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org