Zajímavá nastavení lockback

Základní konfigurační soubor lockback.xml

<configuration>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>

    <root level="info">
        <appender-ref ref="STDOUT" />
    </root>
</configuration>

Zapnutí debug režimu pro lockback

<configuration debug="true">

Při startu v logu přibydou tyto informace

09:11:33,623 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
09:11:33,624 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
09:11:33,624 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/home/vitfo/IdeaProjects/webflux-postgres/build/resources/main/logback.xml]
09:11:33,677 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
09:11:33,678 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
09:11:33,680 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:11:33,691 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
09:11:33,691 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
09:11:33,692 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
09:11:33,692 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@f5ac9e4 - Registering current configuration as safe fallback point
09:11:33,865 |-WARN in Logger[org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator] - No appenders present in context [default] for logger [org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator].
09:11:33,867 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
09:11:33,867 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
09:11:33,868 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:11:33,868 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
09:11:33,869 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@4816278d - Propagating INFO level on Logger[ROOT] onto the JUL framework
09:11:33,870 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
09:11:33,870 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
09:11:33,870 |-INFO in org.springframework.boot.logging.logback.SpringBootJoranConfigurator@727eb8cb - Registering current configuration as safe fallback point

Přenahrání konfigurace logování

<configuration debug="true" scan="true" scanPeriod="10 seconds">
09:17:54,248 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan for changes in [file:/home/vitfo/IdeaProjects/webflux-postgres/build/resources/main/logback.xml] 
09:17:54,248 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeTask scanning period to 10 seconds

Změna v konfiguračním souboru (např. změna úrovně logování na debug)

09:19:34,533 |-INFO in ReconfigureOnChangeTask(born:1618211874532) - Detected change in configuration files.
09:19:34,534 |-INFO in ReconfigureOnChangeTask(born:1618211874532) - Will reset and reconfigure context named [default]
09:19:34,533 |-INFO in ReconfigureOnChangeTask(born:1618211874532) - Detected change in configuration files.
09:19:34,534 |-INFO in ReconfigureOnChangeTask(born:1618211874532) - Will reset and reconfigure context named [default]
09:19:34,540 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan for changes in [file:/home/vitfo/IdeaProjects/webflux-postgres/build/resources/main/logback.xml] 
09:19:34,540 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeTask scanning period to 10 seconds
09:19:34,541 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
09:19:34,541 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
09:19:34,541 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:19:34,542 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to DEBUG
09:19:34,543 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
09:19:34,543 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
09:19:34,543 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@2db2313c - Registering current configuration as safe fallback point
09:19:55.705 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)

Po změně bez restartu serveru je nově logování na úrovni debug

Napsat komentář