How to delete older rolled over log4j2 logs, keeping up to 10 files?

后端 未结 2 2044
自闭症患者
自闭症患者 2021-01-04 18:13

What I want is:

  • Maximum of 10 log files, in total
  • Each log file, not more than 50MB in size.

Thus the logs folder never grows

2条回答
  •  没有蜡笔的小新
    2021-01-04 18:56

    The TimeBasedTriggeringPolicy works based of the filePattern. Basically, the smallest unit of time in the file pattern (%d) is the triggering time interval. In your case the value is 'dd' hence the policy is triggered every day.

    The presence of %i in your filePattern keeps multiple log files for a day. I would recommend trying without the %i in the filePattern.

提交回复
热议问题