[ 
https://issues.apache.org/jira/browse/LOG4J2-3412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17498201#comment-17498201
 ] 

Ralph Goers commented on LOG4J2-3412:
-------------------------------------

[~Dundigala] You can either do as Piotr suggests or you can create a 
subdirectory for the rolled over files and change the filePattern to reference 
that. 

Also, you don't have a delete action configured so the rolled over files will 
never be deleted by Log4j. If you add one Log4j can ensure that you do not run 
out of disk space.

[~ppkarwasz] What documentation are you thinking needs fixing?

> 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)

Reply via email to