[ 
https://issues.apache.org/jira/browse/LOG4J2-3412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Srikanth updated LOG4J2-3412:
-----------------------------
    Environment: 
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.

  was:
etails 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.


> 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
>         Environment: 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.
>            Reporter: Srikanth
>            Priority: Major
>              Labels: Rollover, log4j2
>
> Rolling file is not creating the next day and previous day file is being 
> written with new logs in windows tomcat



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to