When logback.xml exists in class path, logback will be initialized in very early stage, to be exact, at the time of SpringApplication instance is created.
For there is a static Log reference of Log in SpringApplication class, as shown in the following line.
private static final Log logger = LogFactory.getLog(SpringApplication.class);
Otherwise, if logback-spring.xml exists in class path, logback will be initialized a little bit later by LoggingApplicationListener, at this time, Logback Extensions included in Spring Boot , such as springProfile and springProperty tags , are loaded and can be used in logback-spring.xml.
For the Logback Extensions Spring Boot provides, see the following page in the Reference guide.
Either file is OK , but if you want to use Logback Extensions included in Spring Boot, use logback-spring.xml as the log configuration file.