[
https://issues.apache.org/jira/browse/LOG4J2-3450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17513460#comment-17513460
]
Ralph Goers commented on LOG4J2-3450:
-------------------------------------
Not that it makes much of a difference, but I believe this is the first error I
have seen from you!
Your example of Spring Boot is wrong. Every Spring Boot application provides a
class with a main method. Virtually all that main method usually does is call
SpringApplication.run(). If you look at
[SpringApplication|https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L174]
you will see it calls LogFactory.getLog(). This causes default logging
initialization to occur as Spring Boot has done literally nothing yet. This
default logging stays in place until Spring Boot initializes its own logging
subsystem which it does, by the way, 3 to 4 times depending on what Spring
components you include and what version of Spring Boot you are using.
That said, I would agree that all calls to Configurator.initialize() that
include a Configuration or a config location should not cause default logging
to initialize.
> Add mechanism to disable Log4j2 automatic configuration
> -------------------------------------------------------
>
> Key: LOG4J2-3450
> URL: https://issues.apache.org/jira/browse/LOG4J2-3450
> Project: Log4j 2
> Issue Type: Task
> Reporter: Piotr Karwasz
> Assignee: Piotr Karwasz
> Priority: Minor
>
> Log4j2 automatic configuration is useful in most circumstances.
> However in specific environments it only adds some start-up time to the
> application. Such a specific environment is for example Spring Boot: Spring
> Boot reconfigures Log4j2 at a very early stage of its startup sequence, but
> *after* the automatic configuration. As a result Log4j2 is configured twice.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)