1. Description
Project started, Logback configuration error (FileNamePattern format and timeBasedFileNamingAndTriggeringPolicy did not correspond to it).
environment
IDE: 2021.3
spring boot: 2.5.6 (spring-boot-starter-logging: 2.5.6 --- logback-classic: 1.2.6)
Configuration 1:
<FileNamePattern>${LOG_HOME}/info${LOG_NAME}_%d{yyyy-MM-dd}.part_%i.log</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy" />
Configuration 2:
<FileNamePattern>${LOG_HOME}/info${LOG_NAME}_%d{yyyy-MM-dd}.log</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10KB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
2. Problems
Question 1:
Logging system failed to initialize using configuration from 'null'
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Filename pattern [/var/demo_log_logback_%d{yyyy-MM-dd}.part_%i.log] contains an integer token converter, i.e. %i, INCOMPATIBLE with this configuration. Remove it.
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:179)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:80)
Question 2:
Logging system failed to initialize using configuration from 'null'
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@56cdfb3b - Missing integer token, that is %i, in FileNamePattern [/var/demo_log_logback_%d{yyyy-MM-dd}.log]
ERROR in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@56cdfb3b - See also http://logback.qos.ch/codes.html#sat_missing_integer_token
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:179)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:80)
reason:
DefaultTimeBasedFileNamingAndTriggeringPolicy: Do not Support %i
SizeAndTimeBasedFNATP: Need %i
3. Solution
Adjust the parameter value format of FileNamePattern.
4. Information
Logback manual appender label: https://logback.qos.ch/manual/appenders.html
Read More:
- [Solved] logback log format adjustment error: Failed to create converter for [%M] keyword
- MAC-XXL_JOB Error: Failed to create parent directories for [/data/applogs/xxl-job/xxl-job-admin.log
- [Solved] Logging system failed to initialize using configuration from ‘classpathlogbacklogback-spring.xml‘
- [Solved] Bat starts springboot project error: ERROR org.springframework.boot.SpringApplication -Application run failed
- Springboot Run Error: java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Handler
- log4j:WARN No appenders could be found for logger (freemarker.cache)
- [Solved] Springboot Error: org.apache.catalina.core.ContainerBase : A child container failed during start
- [Solved] failed to req API:localhost:8848/nacos/v1/ns/instance. code:500 msg: java.net.ConnectException
- The authentication server Configurate NoClassDefFoundError Error (store client information in a JDBC-based database)
- How to Solve Gradle Error: Plugin with id ‘jetty’ not found.
- [Tomcat Error] SEVERE: Error listenerStart
- Tk.mapper Common mapper Error: Error creating bean with name ‘commonMapper‘ defined in file xxx
- [Solved] SpringBoot Project Start Error: No bean named ‘org.springframework.context.xxxxx.importRegistry‘ available
- [Solved] JWT + SSO Error: Error creating bean with name ‘jwtTokenServices’
- [Solved] Springcloud Add gateway to Startup Error: Exception encountered during context initialization – cancelling refresh
- [Solved] liquibase.exception.ValidationFailedException: Validation Failed
- [Solved] hytrix service degraded bean cannot inject error
- [Solved] Failed to bind properties under ‘spring.datasource.type‘ to java.lang.Class<javax.sql.DataSource>
- [Solved] Spring cloud config server can’t parse the YML file of the remote warehouse, and it will also report an error
- [Solved] swagger3 Error: org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException