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

Hi,
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"/>
			<Policies>
				<OnStartupTriggeringPolicy/>
				<!-- SizeBasedTriggeringPolicy size="64 MB"/ -->
				<CronTriggeringPolicy schedule="0 0 0 * * MON"/>
			</Policies>
			<DefaultRolloverStrategy max="3"/>
		</RollingFile>

Any suggestion is appreciated!

Try 0 0 0 ? * MON. Syntax is explained here: CronExpression (Apache Log4j Core 2.23.1 API)

1 Like

Thank you!