I am using it in SpringBoot Application. It should bot create more than five files. But, it has no limit. Here is the code.
name=PropertiesConfig
property.filename=abc.log
# configuration to print on console
appender.console.type=Console
appender.console.name=STDOUT
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss} [%t] %C{1}:%L - %msg%n
# configuration to print into file
appender.rolling.type=RollingFile
appender.rolling.name=RollingFile
appender.rolling.fileName=${filename}
appender.rolling.filePattern=abc.%d{MM-dd-yyyy-HH-mm-ss}.log.gz
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss} [%t] %C{1}:%L - %msg%n
appender.rolling.policies.type=Policies
appender.rolling.policies.size.type=SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=10MB
appender.rolling.strategy.type=DefaultRolloverStrategy
appender.rolling.strategy.max = 5
rootLogger.level=trace
rootLogger.appenderRef.stdout.ref=STDOUT
rootLogger.appenderRef.file.ref=RollingFile
question from:
https://stackoverflow.com/questions/65839548/how-can-we-set-maximum-number-of-log-files-in-log4j2-properties-and-what-else 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…