Log4net
  1. Log4net
  2. LOG4NET-361

RollingLogFileAppender does not correctly initialize the backup index when style is date or composite

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.2.11
    • Fix Version/s: 1.2.12
    • Component/s: Appenders
    • Labels:
      None

      Description

      If there are no log files when a process starts, everything is fine. A new log is created and the files are properly rolled to .1, .2, .3, etc. A new log is also created the next day with correct indexes.

      However, if log files exist for any day when the process starts, RollingLogFileAppender incorrectly initializes the starting backup index to the maximum index for all days instead of using the maximum index for the current day. In other words, it completely ignores the date pattern when determining whether to consider a particular file in the backup index algorithm.

      It looks like the error stems from the following code being commented out on lines 893-901:

      if (m_staticLogFileName)
      {
      int endLength = curFileName.Length - index;
      if (baseFile.Length + endLength != curFileName.Length)

      { // file is probably scheduledFilename + .x so I don't care return; }

      }

      This code is not commented out in 1.2.10 and we do not see the issue after downgrading to the earlier release.

        Issue Links

          Activity

          Brenda Bell created issue -
          Hide
          Dominik Psenner added a comment -

          The same symptoms were fixed with LOG4NET-378. Please reopen the issue if that's not the case.

          Show
          Dominik Psenner added a comment - The same symptoms were fixed with LOG4NET-378 . Please reopen the issue if that's not the case.
          Dominik Psenner made changes -
          Field Original Value New Value
          Link This issue is duplicated by LOG4NET-378 [ LOG4NET-378 ]
          Dominik Psenner made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Dominik Psenner [ nachbarslumpi ]
          Fix Version/s 1.2.12 [ 12318546 ]
          Resolution Duplicate [ 3 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          203d 16h 32m 1 Dominik Psenner 28/May/13 12:50

            People

            • Assignee:
              Dominik Psenner
              Reporter:
              Brenda Bell
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development