
Hello Thanks for the answer. I am still a bit confused. If the logback FileNamePattern is "app.log.%d{yyyyMMdd_HHmmss}Z.log", would this by default mean its going to rollover every second? In other words , does the fileNamePattern define the rollover schedule? You mention using "yyyy-ww" to trigger a weekly Rollover, would this mean the fileName pattern should be made "app.log%d{yyyy-ww}Z.log" ? Is it possible to decouple the Name of the Rolled over log file and the tiriggering of RollOver ? What if Iwant a rollover every week , but the name of the Rolled Over file to have hhmmss as part of it? I Sorry if I have caused confusion here Best Regards Ani On Mon, Feb 12, 2024 at 12:36 PM Ceki Gulcu via logback-user < logback-user@qos.ch> wrote:
Hi Ani,
Logback does not support cron-like triggering. However, it supports triggering based on a date pattern, e.g "yyyy-MM-dd"
The schedule "0 0 * * 1 ?" corresponds to first day of the week at midnight. The pattern "yyyy-ww" corresponds to the same triggering schedule.
The link below provides more details:
https://logback.qos.ch/manual/appenders.html#tbrpFileNamePattern
I hope this helps,
-- Ceki Gülcü
Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch
On 2/12/2024 8:44 PM, Aniruddha Shevade via logback-user wrote:
Hello I am trying to migrate a application form log4j to logback. I do have the following property defined in the existing log4j2.xml file, I do not see any such equivalent in the logback.xml. *How do I specify something like a CronTriggerPolicy as shown below?* Any help would be appreciated.
log4j2.xml
<RollingFile name="myLog" fileName="app.log" filePattern"app.log.%d{yyyyMMdd_HHmmzz}Z.log> <Policies> * <CronTiggerPolicy schedule="0 0 * * 1 ?" evaluateOnStartup="true">* <SizeBasedTriggerPolicy size="10MB"/> </Policies> </RollingFile>
Best regards Ani
_______________________________________________ logback-user mailing list logback-user@qos.ch https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user