You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Rupesh (Jira)" <ji...@apache.org> on 2023/08/09 09:03:00 UTC

[jira] [Created] (LOG4J2-3667) Logger is logging logs in the wrong date file.

Rupesh created LOG4J2-3667:
------------------------------

             Summary: Logger is logging logs in the wrong date file.
                 Key: LOG4J2-3667
                 URL: https://issues.apache.org/jira/browse/LOG4J2-3667
             Project: Log4j 2
          Issue Type: Bug
          Components: Log4j-to-SLF4J
    Affects Versions: 2.17.1
            Reporter: Rupesh


One of our applications is using log4j2 version 2.17.1 with slf4j.
Here we are facing issue of logging of logs in the older date files like logs which should go to 19-july-2023 those are actually getting logged in 18-july-2023.
Lately also observed that it is logging logs of 8-aug-2023 logs in 3-aug-2023 file.
 
we have tried setting timezone as well but still the issue persists, following is the configuration for the same.
<properties>
<property name="log4j.rootLogger.timezone" value="CDT" />
</properties>
 
Here is the appender configuration in log4j2.xml,
<EcwRollingRandomAccessFile name="FILE"
fileName="${sys:pathfile}/${date:yyyy-MM-dd}.log"
filePattern="${sys:pathfile}/%d\{yyyy-MM-dd}.log.gz"
immediateFlush="true" append="true">
<PatternLayout pattern="%-5p | %d\{yyyy-MM-dd HH:mm:ss zzz} | ${sys:AppVer} | [%t] %C\{2} (%F:%L) - %m | %X%n" />
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
</Policies>
<DefaultRolloverStrategy>
<Delete basePath="${sys:pathfile}">
<IfFileName glob="//*.log.gz" />
<IfLastModified age="60d" />
</Delete>
</DefaultRolloverStrategy>
</EcwRollingRandomAccessFile>
 
Here is the list of jars we are using in our application.
log4j-api-2.17.1.jar
log4j-core-2.17.1.jar
log4j-slf4j-impl-2.17.1.jar
slf4j-api-1.7.36.jar 
 
 
Could you please suggest let us know and suggest the solution around it? 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)