Skip to content

Commit

Permalink
Clear files before the MaxHistory log4cplus#381
Browse files Browse the repository at this point in the history
TimeBasedRollingFileAppender: Clear files before the MaxHistory when CleanHistoryOnStart false. log4cplus#381
  • Loading branch information
zcteo authored and wilx committed Aug 15, 2021
1 parent eecfa06 commit fc034d5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fileappender.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1330,10 +1330,14 @@ TimeBasedRollingFileAppender::init()
Time now = helpers::now();
nextRolloverTime = calculateNextRolloverTime(now);

if (cleanHistoryOnStart)
if (LOG4CPLUS_UNLIKELY(cleanHistoryOnStart))
{
clean(now + maxHistory*getRolloverPeriodDuration());
}
else
{
clean(now);
}

lastHeartBeat = now;
}
Expand Down

0 comments on commit fc034d5

Please sign in to comment.