[
https://issues.apache.org/jira/browse/LOG4J2-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16886985#comment-16886985
]
Bohdan Chupika commented on LOG4J2-1631:
----------------------------------------
Log file output:
{noformat}
[root@centnode hellologs]# cat logs/app.log
2019-07-15 23:59:52,333 INFO HelloWorld This is info : message
2019-07-15 23:59:52,343 WARN HelloWorld This is warn : message
2019-07-15 23:59:52,343 ERROR HelloWorld This is error : message
2019-07-15 23:59:52,343 FATAL HelloWorld This is fatal : message
2019-07-16 00:00:13,873 INFO HelloWorld This is info : message
2019-07-16 00:00:13,875 WARN HelloWorld This is warn : message
2019-07-16 00:00:13,876 ERROR HelloWorld This is error : message
2019-07-16 00:00:13,876 FATAL HelloWorld This is fatal : message
{noformat}
*I am expecting that logs from 2019-07-15 should be rollover and placed in the
file foo-07-15-2019-1.log*
This is my config:
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<Console name="LogToConsole" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS}{UTC} [%t] %-5level
%logger{36} - %msg%n"/>
</Console>
<RollingRandomAccessFile name="LogToRollingRandomAccessFile"
fileName="logs/app.log"
filePattern="logs/foo-%d{MM-dd-yyyy}{UTC}-%i.log">
<PatternLayout>
<Pattern>%d{yyyy-MM-dd HH:mm:ss,SSS}{UTC} %-5p %c{1}
%m%throwable{30}%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="10 MB"/>
</Policies>
<DefaultRolloverStrategy max="5"/>
</RollingRandomAccessFile>
</Appenders>
<Loggers>
<!-- avoid duplicated logs with additivity=false -->
<Logger name="com.mkyong" level="info" additivity="false">
<AppenderRef ref="LogToRollingRandomAccessFile"/>
<AppenderRef ref="LogToConsole"/>
</Logger>
<Root level="error">
<AppenderRef ref="LogToConsole"/>
</Root>
</Loggers>
</Configuration>
{code}
Have anyone any suggestions on how to fix this issue?
> RollingFile appender does not rollover file as per TimeZone specified
> ----------------------------------------------------------------------
>
> Key: LOG4J2-1631
> URL: https://issues.apache.org/jira/browse/LOG4J2-1631
> Project: Log4j 2
> Issue Type: Bug
> Affects Versions: 2.7
> Reporter: Wassi Sandhu
> Priority: Major
>
> RollingFile appender does not rollover file as per TimeZone specified. The
> appender roll over according to LOCAL time in spite of providing TimeZone in
> filePattern
> Expected: The rollover should happen as per specified TimeZone
> <RollingFile name="RollingFile" fileName="${baseDir}/app.log"
>
> filePattern="${baseDir}/$${date:yyyy-MM}{GMT}/app-%d{yyyy-MM-dd}{GMT}.log.gz">
> ....
> ....
> </RollingFile>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)