Possible to roll log file every week? CronTriggeringPolicy doesn't seem to work

I’m trying to configure log4j2.xml to roll log file every week instead of based on size. I have the following configuration which doesn’t seem to work, it creates new log file every day at midnight. Is my cron expression wrong or maybe there is some bug in CronTriggeringPolicy?

		<!-- Rolling file appender -->
		<RollingFile fileName="${sys:openhab.logdir}/openhab.log" filePattern="${sys:openhab.logdir}/openhab_%d{yyyy-MM-dd_HH-mm}.log.gz" name="LOGFILE">
			<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n"/>
				<!-- SizeBasedTriggeringPolicy size="64 MB"/ -->
				<CronTriggeringPolicy schedule="0 0 0 * * MON"/>
			<DefaultRolloverStrategy max="3"/>

Any suggestion is appreciated!

Try 0 0 0 ? * MON. Syntax is explained here: https://logging.apache.org/log4j/2.0/log4j-core/apidocs/org/apache/logging/log4j/core/util/CronExpression.html

1 Like

Thank you!