private void RollOverIfDateBoundaryCrossing()

in src/log4net/Appender/RollingFileAppender.cs [705:731]


  private void RollOverIfDateBoundaryCrossing()
  {
    if (StaticLogFileName && _rollDate)
    {
      if (_baseFileName is not null && FileExists(_baseFileName))
      {
        DateTime last;
        using (SecurityContext?.Impersonate(this))
        {
          last = DateTimeStrategy is UniversalDateTime
            ? System.IO.File.GetLastWriteTimeUtc(_baseFileName)
            : System.IO.File.GetLastWriteTime(_baseFileName);
        }

        LogLog.Debug(_declaringType, $"[{last.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo)}] vs. [{_now.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo)}]");

        if (!StringComparer.Ordinal.Equals(last.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo), 
                                           _now.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo)))
        {
          _scheduledFilename = CombinePath(_baseFileName, last.ToString(DatePattern, DateTimeFormatInfo.InvariantInfo));
          LogLog.Debug(_declaringType, $"Initial roll over to [{_scheduledFilename}]");
          RollOverTime(false);
          LogLog.Debug(_declaringType, $"curSizeRollBackups after rollOver at [{CurrentSizeRollBackups}]");
        }
      }
    }
  }