Update of RollingFile & OnStartupTriggeringPolicy documentation would be nice #2675
michal-tuma
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Thanks, we'll take this into account in #2528. BTW: why did you choose |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I spend couple of hours understanding why my log4j config don't rollover the log file on startup (OnStartupTriggeringPolcy) using my configured composite policy:
I found out that I'm just super stupid. Like many-times before. I had defined
append=false
in RollingFileAppender.That is the reason why OnStartupTrigerringPolicy did not rollover log file when JVM starts:
THAT'S IT, WORKS AS CODED, I'M STUPID.
But that takes me 3 hours to understand.
Please can you just update the https://logging.apache.org/log4j/2.x/manual/appenders.html#onstartup-triggering-policy with a note in a sence:
WARNING: Be sure you don't set
append="false"
for a rolling file appender in a combination with OnStartupTrigerringPolicy. Otherwise before OnStartupTrigerringPolicy is being evaluated the rolling file appender create empty file. Thus the old log file is deleted before policy is evaluated. Which finally ends up the old file is not rollovered at all.Or similar, more explainable warning. Just to save peoples time in future before they realize the same as me.
Thank you very much in advance,
Michal
Beta Was this translation helpful? Give feedback.
All reactions