Spring-Boot only allows limited properties set in its application.properties. See here .
The default configuration (ready-made) used when using Spring-boot is defined in the base.xml file. See base.xml config here , which includes this appender file
There are 2 ways to add additional configuration.
If there is an XML log configuration code in the path to the project class with the name logback- spring.xml, it is selected during the initialization of Spring-Boot.
- Specify the configuration file from application.properties
Inside application.properties, use the following command to point to your own XML login
logging.config=
Once you add additional configuration using either of the above two steps, the rollover strategy can be mentioned in this custom XML, such as
<?xml version="1.0" encoding="UTF-8"?> <configuration scan="true"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <charset>UTF-8</charset> <Pattern>%d %-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern> </encoder> </appender> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder> <pattern>${FILE_LOG_PATTERN}</pattern> </encoder> <file>${LOG_FILE}</file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>${LOG_FILE}.%i</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <MaxFileSize>10MB</MaxFileSize> </triggeringPolicy> </appender> <root level="DEBUG"> <appender-ref ref="CONSOLE" /> <appender-ref ref="FILE"/> </root> </configuration>
source share