Add maxFileSize and maxBackupIndex in logging.yml but won't work

my logging.yml looks like below:
file:
type: dailyRollingFile
file: ${path.logs}/${cluster.name}.log
datePattern: "'.'yyyy-MM-dd"
maxFileSize: 1GB
maxBackupIndex: 15
layout:
type: pattern
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

so how to achieve so?

1 Like

The daily rolling file doesn't have a maxBackupIndex configuration, only the rolling file appender has it:
https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/RollingFileAppender.html
If you want to achieve the same functionality you'll have to write a custom appender.

1 Like