Hi all,
I try to combine a log4j2 SizeBasedTriggeringPolicy with a CronTriggeringPolicy
to roll over a file either at midnight or every 20MB (every minute or every
100KB for testing) like this:
<RollingFile name="RollingFile"
filePattern="target/logs/foobar-%d{yyyyMMdd-HHmmss}{UTC}.log">
<Layout type="PatternLayout" pattern="%date{DEFAULT} | %message%n" />
<Policies>
<SizeBasedTriggeringPolicy size="100KB" />
<CronTriggeringPolicy schedule="0 * * * * ? *" evaluateOnStartup="true"
/>
</Policies>
</RollingFile>
Unfortunately only the CronTriggeringPolicy seems to work in this combination.
No roll over is done when the file size limit is reached. Removing the
'CronTriggeringPolicy ' from the configuration will let the roll over happen
every 100KB as expected.
Beware of the fact that I can not use the TimeBasedTriggeringPolicy because I
need to have a second accurate date in the file name pattern but I want to roll
over just every day (or every minute for testing here).
Is this (unabalibility of combining CronTriggeringPolicy with other policies) a
know bug or limitation when using the CronTriggeringPolicy?
I also asked this question on SO but without response so far:
https://stackoverflow.com/q/54406364/367285
Any help would be appriciated.
Thanks ab best regards,
Franz
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]