I have an application that runs on several servers which have been running for a few months with a java application that uses logback. Turns out we forgot to limit the history size.
I configured the following params:
- maxHistory: 10
- cleanHistoryOnStart: true
I redeployed the app but when it started, the files remained and haven't been deleted.
Shouldn't this configuration make sure that the files are deleted upon startup? What would be the way to do it?
It's an old question but in case someone else struggles with this, here are some possible reasons this could happen:
maxHistory
value means something unexpected. From Logback
documentation:
For example, if you specify monthly rollover, and set maxHistory to 6, then 6 months worth of archives files will be kept with files older than 6 months deleted.
cleanHistoryOnStart
was introduced in 1.0.1In the last 3 cases an error should be logged somewhere, reading:
Logback file error : no applicable action for [cleanHistoryOnStart], current pattern is [...]
If you're not sure if you're checking the right place, spell it wrong by intention and hunt the log. Then correct the misspelling and check if the error is still there (this time because it's invalid).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With