enable a dynamic fileName (server.{date}.log )in RollingFile #2560
Unanswered
LellaNikhil
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question:
How to enable dynamic fileName in RollingFileAppender
I have a requirement where i need to create a log file like
server.2024-04-30.log and it has some size based policies when roll over happens the existing file should be renamed to server.2024-04-30.1.log and when the day changes a new file need to be created like server,2024-05-01.log
server.2024-04-30.log
server.2024-04-30.1.log
server.2024-04-30.2.log
and when day changes it should be
server.2024-05-01.log
I have tried different approaches
Approach1:
size based rolling is happening fine but when the day changes the fileName was the old date when i have restarted the application, rollover files have correct date as filePattern is working.
Approach2:
followed the discussion on https://issues.apache.org/jira/browse/LOG4J2-1185 and remove the fileName and tried it , log file itself is not getting created
Any help would be appreciated
Beta Was this translation helpful? Give feedback.
All reactions