logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hachey, Philip" <Philip.Hac...@nrc-cnrc.gc.ca>
Subject Re: Issues with Log4j2 2.5 overwriting log files
Date Thu, 24 May 2018 16:20:59 GMT
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}">


On 2018-05-24 08:23 AM, viscapi@cines.fr<mailto:viscapi@cines.fr> wrote:


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:


<RollingFile name="RollingFile" fileName="log/arcsys_all.log.${date:yyyy-MM-dd}" filePattern="log/arcsys_all.log.%d{yyyy-MM-dd}">
                                <Pattern>%p %d{yyyy-MM-dd HH:mm:ss} [%t] (%F:%L)- %m%n</Pattern>
                                <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
                        <DefaultRolloverStrategy max="100">
                                <Delete basePath="log" maxDepth="2">
                                        <IfFileName glob="*/arcsys_all-*.log.gz">
                                                <IfLastModified age="30d">

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,




CINES (Montpellier, France)

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org<mailto:log4j-user-unsubscribe@logging.apache.org>
For additional commands, e-mail: log4j-user-help@logging.apache.org<mailto:log4j-user-help@logging.apache.org>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message