[
https://issues.apache.org/jira/browse/LOG4J2-3412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17497765#comment-17497765
]
Ralph Goers commented on LOG4J2-3412:
-------------------------------------
Your file pattern and file name are essentially the same. This is bound to
cause problems Either it will try to rename the file to itself or it will be
renamed to match the file being used the next day.
I would suggest you add status = DEBUG to the configuration or use
-Dlog4j2.debug=true when starting the application.
> Rolling file does not work with new version of log4j2 2.16 and 2.17.1 versions
> ------------------------------------------------------------------------------
>
> Key: LOG4J2-3412
> URL: https://issues.apache.org/jira/browse/LOG4J2-3412
> Project: Log4j 2
> Issue Type: Bug
> Components: API, Appenders
> Affects Versions: 2.16.0, 2.17.0
> Reporter: Srikanth
> Priority: Major
> Labels: Rollover, log4j2
>
> Rolling file is not creating the next day log file and previous day file is
> being written with new logs in windows tomcat
> Details of logging.properties used:
>
> {code:java}
> rootLogger.level = all
> appenders = rolling, console
> appender.console.type = Console
> appender.console.name = console
> appender.console.layout.type = PatternLayout
> appender.console.layout.pattern = %d [%-5p] (%F:%M:%L) %m%n
> appender.rolling.type = RollingFile
> appender.rolling.name = rolling
> appender.rolling.fileName = C:/Local/Logs/${date:yyyyMMdd}_myfile.log
> appender.rolling.filePattern = C:/Local/Logs/%d{yyyyMMdd}_myfile.log
> appender.rolling.layout.type = PatternLayout
> appender.rolling.layout.pattern = %d [%-5p] [%F:%M:%L] %m%n
> appender.rolling.policies.type = Policies
> appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
> appender.rolling.policies.time.interval = 1
> appender.rolling.policies.time.modulate = true
> rootLogger.appenderRefs = rolling, console
> rootLogger.appenderRef.console.ref = console
> rootLogger.appenderRef.rolling.ref = rolling
> rootLogger.appenderRef.stdout.ref = console, rolling
> {code}
>
> =======================================
> I am using below configuration for the java web application: Tomcat 9.x
> log4j-api-2.16.0.jar
> log4j-core-2.16.0.jar
>
> I even tried with 2.17.1 version as well.
>
> everying working fine , logs are generating but when i trigger the log file
> next day the logs are triggring in old day file only.
> suppose today (12-01-2022) i am hitting the URL. The file creates and logging
> data in the file 20220112_myfile.log
> i change the date and hitting the URL again, Here i am expecting the code
> should create 20220113_myfile.log, but the log file not creating instead all
> logs are going in the 20220112_myfile.log.
> After i restart the server the new file generating, but i need the file by
> hitting the URL if it is a different date the log file to be created with the
> same date, not by restarting the server.
> Can someone help me on this.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)