It seems odd to me that you have a date pattern in both the "fileName"
attribute and the "filePattern" attribute. I suggest getting rid of the date
pattern from the fileName attribute so the first line looks like:
<RollingFile name="RollingFile" fileName="log/arcsys_all.log"
filePattern="log/arcsys_all.log.%d{yyyy-MM-dd}">
Philip
On 2018-05-24 08:23 AM, [email protected]<mailto:[email protected]> wrote:
Hi,
We are having issues with log4j2 2.5 on some of our servers. When data is still
being processed at midnight, the current log file doesn't rotate and past
entries are being overwritten. The expected behavior would be to write the
latest log entries to the new log file, without overwriting anything. When
there's no activity around midnight, things are working just fine.
I had a look at our log4j2.xml configuration file some days ago, and I think
we're using the RollingFile appender:
http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender
<RollingFile name="RollingFile"
fileName="log/arcsys_all.log.${date:yyyy-MM-dd}"
filePattern="log/arcsys_all.log.%d{yyyy-MM-dd}">
<PatternLayout>
<Pattern>%p %d{yyyy-MM-dd HH:mm:ss} [%t]
(%F:%L)- %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1"
modulate="true"/>
</Policies>
<DefaultRolloverStrategy max="100">
<Delete basePath="log" maxDepth="2">
<IfFileName
glob="*/arcsys_all-*.log.gz">
<IfLastModified age="30d">
</IfLastModified>
</IfFileName>
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
We tried raising the verbosity level to TRACE in order to find the root cause
of this issue, but to no avail...
As a workaround, we decided to stop processing new data a couple of hours
before log rotation, and to make a back-up copy of the current log file to
avoid any data loss.
What are we doing wrong ?
Any help would be greatly appreciated.
Best regards,
Samuel
--
Samuel VISCAPI
CINES (Montpellier, France)
---------------------------------------------------------------------
To unsubscribe, e-mail:
[email protected]<mailto:[email protected]>
For additional commands, e-mail:
[email protected]<mailto:[email protected]>