Under development and test environment the ROOT logger level is DEBUG or INFO. The spring-boot banner is displayed at application startup:
2017-03-23 14:31:00,322 [INFO ] -
:: Spring Boot :: (v1.5.2.RELEASE)
:: Application :: AcMe (v1.0-SNAPSHOT)
:: Build :: 2017-03-23 09:53
But when running in a production environment the my ROOT logger level is normally WARN. This causes the banner not to be printed out.
How to configure logback so that the banner will be displayed also in production?
My guess was to add another logger, but the following (and alike configuration) did not work:
<logger name="org.springframework.web" level="INFO" additivity="false">
<appender-ref ref="FILE"/>
</logger>
Here my configuration
application.properties:
spring.main.banner-mode=log
application-devel.properties:
logging.config=classpath:logging-spring-devel.xml
application-production.properties:
logging.config=classpath:logging-spring-production.xml
logging-devel.xml (banner displayed)
LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}application.log}"/>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE}</file>
...
</appender>
<root level="INFO">
<appender-ref ref="FILE"/>
</root>
</configuration>
logging-production.xml (banner not displayed)
LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}application.log}"/>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE}</file>
...
</appender>
<root level="WARN">
<appender-ref ref="FILE"/>
</root>
</configuration>