[logback-user] migration from log4j to logback. help with specific log4j.xml property (CronTriggerPolicy>

Ceki Gulcu ceki at qos.ch
Mon Feb 12 22:04:26 UTC 2024


Responses inline.

On 2/12/2024 10:56 PM, Aniruddha Shevade via logback-user wrote:
> 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?

That is correct, the fileNamePattern defines 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" ? 

Yes. However, automatic file compression is enabled if the value of the
fileNamePattern option ends with .gz or .zip but not Z.


> 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

Complete decoupling is not possible however you can have multiple %d
specifiers. See the link provided earlier.

> Best Regards
> Ani
> 
-- 
Ceki Gülcü

Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch


More information about the logback-user mailing list