Details
Description
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:
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
=======================================
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.