Details
-
Sub-task
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
3.3.0
-
None
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 attached to the root logger.
- A PatternLayout 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.
Attachments
Issue Links
- causes
-
SPARK-37792 Spark shell sets log level to INFO by default
- Resolved
- links to