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

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

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

Ralph Goers commented on LOG4J2-3667:
-------------------------------------

Can you please start your application with -Dlog4j2.debug=true and provide the output from that after a day or two?

> 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
>            Assignee: Ralph Goers
>            Priority: Critical
>         Attachments: logging_to_wrong_date_file.png
>
>
> 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,
> {code:java}
> <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> {code}
>  
> 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 
>  
>  Please check attached screenshot of logs.
> Could you please suggest let us know and suggest the solution around it? 



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