Skip to content

Used on Routes, CronTriggeringPolicy is not executed correctly #3621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Class-New opened this issue Apr 17, 2025 · 0 comments
Open

Used on Routes, CronTriggeringPolicy is not executed correctly #3621

Class-New opened this issue Apr 17, 2025 · 0 comments

Comments

@Class-New
Copy link

Class-New commented Apr 17, 2025

@ppkarwasz

`

	  <Routes pattern="$${ctx:ROUTINGKEY}">
		<Route key="$${ctx:ROUTINGKEY}">
		  <RollingFile name="Rolling-default" fileName="${log.path}/common.log"
				filePattern="${log.path}/common-%d{yyyy-MM-dd}-%i.log.gz">
			<PatternLayout>
				<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %X{flowno} %t %-5p %c:%L %m%n</pattern>
			</PatternLayout>
			<Policies>
			  <SizeBasedTriggeringPolicy size="256 MB" />
			</Policies>
			<DefaultRolloverStrategy max="100"/>
		  </RollingFile>
		</Route>
		<Route>
		  <RollingFile name="Rolling-${ctx:ROUTINGKEY}" fileName="${log.path}/${ctx:ROUTINGKEY}.log"
			filePattern="${log.path}/${ctx:ROUTINGKEY}-%d{yyyy-MM-dd}-%i.log.gz">
			<PatternLayout>
				<pattern>%d{yyyy-MM-dd 'at' HH:mm:ss.SSS} %X{flowno} %t %-5p %c:%L %m%n</pattern>
			</PatternLayout>
			<Policies>
				<CronTriggeringPolicy evaluateOnStartup="true" schedule="0 0 0 * * ?">
				<SizeBasedTriggeringPolicy size="256 MB" />
			</Policies>
			<DefaultRolloverStrategy max="100"/>
		  </RollingFile>
		</Route>
	  </Routes>
	</Routing>`

I expected every time the log roll back to the specified folder, is looking forward to every day 0 am to log rolled back, but the test found that don't take effect, only the present a log time will only take effect on arrival (TimeBasedTriggeringPolicy is so, That's why I changed the CronTriggeringPolicy), and another interesting phenomenon is that schedule="0 * * * * ?" The rollback can be performed every minute. Set schedule to "0 0 * * * ?". Or schedule="0 0 0 * * ?" Can't handle it correctly

spring-boot-starter-log4j2: 2.17.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To triage
Development

No branches or pull requests

1 participant