log4php

Apache log4php LoggerAppenderDailyFile maxBackupIndex


In Apache's log4php LoggerAppenderDailyFile appender, is it possible to limit the number of backup files kept?

Like what is done with the LoggerAppenderRollingFile appender's maxBackupIndex parameter.

See: https://logging.apache.org/log4php/docs/appenders/daily-file.html


Solution

  • No configuration available by default from Log4j.

    https://logging.apache.org/log4php/docs/appenders/daily-file.html shows the configuration maxBackupIndex is not available for LoggerAppenderDailyFile unlike LoggerAppenderRollingFile (https://logging.apache.org/log4php/docs/appenders/rolling-file.html)

    One hack is to create a crontab entry to do the same see this link http://www.howtogeek.com/howto/ubuntu/delete-files-older-than-x-days-on-linux/