ログブックは、プログラムの開始時に独自のステータス(INFOまたはWARN)を出力します。本当に面倒です!

15:34:46,181 |-INFO in ch.qos.logback.classic.LoggerContext[default]- Could NOT find resource[logback.groovy]15:34:46,181 |-INFO in ch.qos.logback.classic.LoggerContext[default]- Could NOT find resource[logback-test.xml]15:34:46,181 |-INFO in ch.qos.logback.classic.LoggerContext[default]- Found resource[logback.xml]at[file:/E:/spring-boot-simple/target/classes/logback.xml]15:34:46,247 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
15:34:46,260 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type[ch.qos.logback.core.ConsoleAppender]15:34:46,267 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as[STDOUT]15:34:46,319 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT]- This appender no longer admits a layout as a sub-component, set an encoder instead.
15:34:46,319 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT]- To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
15:34:46,319 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT]- See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
15:34:46,320 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger[org.springframework.web]to ERROR
15:34:46,320 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger[org.springframework.web]to false
15:34:46,320 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named[STDOUT]to Logger[org.springframework.web]15:34:46,320 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger[com.mkyong]to ERROR
15:34:46,320 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger[com.mkyong]to false
15:34:46,320 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named[STDOUT]to Logger[com.mkyong]15:34:46,320 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR
15:34:46,321 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named[STDOUT]to Logger[ROOT]15:34:46,321 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
15:34:46,322 |-INFO in [email protected] - Registering current configuration as safe fallback point

解決策

これを修正するには、次のように `NopStatusListener`を追加します:

logback.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

    <!-- Stop output INFO at start -->
    <statusListener class="ch.qos.logback.core.status.NopStatusListener"/>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <layout class="ch.qos.logback.classic.PatternLayout">
            <Pattern>
                %d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n
            </Pattern>
        </layout>
    </appender>

    <root level="error">
        <appender-ref ref="STDOUT"/>
    </root>

</configuration>