Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-519

Number of RollBackups files extremely increases

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.2.15
    • None
    • None
    • None
    • Win 7

    Description

      We have defined LogManager with repositories. In repositories are the RollingFileAppenders. For each RollingFileAppender are defined values:

      C#, init value settings
              AppendToFile = true;
              RollingStyle = RollingFileAppender.RollingMode.Size;
              MaxSizeRollBackups = maxFileCount;
              MaximumFileSize = maxFileSize;
      

      It works without problems and number of RollBackups files is equal to MaxSizeRollBackups. If values of MaxSizeRollBackups and MaximumFileSize are runtime changed, the MaxSizeRollBackups is ignored, RollBackups files are not deleted and number of RollBackups files extremely increases. There can be more than 1500 files!!!

      RollingFileAppender change in our C# code:

      C#, runtime value changing
        foreach(var v in LogManager.GetRepository(CreateRepositoryName(id)).GetAppenders())
        {
      	if(v is RollingFileAppender)
      	{
      	  RollingFileAppender roll = v as RollingFileAppender;
      	  if (roll.MaximumFileSize != filesize)
      	  {
      		roll.MaximumFileSize = filesize;
      	  }
      	  if (roll.MaxSizeRollBackups != filecount)
      	  {
      		roll.MaxSizeRollBackups = filecount;
      	  }
      	}
        }
      

      Part of log4net logging. There are 22 RollBackups, but maxSizeRollBackups is set to 2. The value of maxSizeRollBackups is ignored.

      log4net logging
      log4net: rolling over count [2058]
      log4net: maxSizeRollBackups [2]
      log4net: curSizeRollBackups [22]
      log4net: countDirection [-1]
      log4net: Moving [C:\01_Data\Main\Trunk\KDA\FC\Core\bin\Debug\LogAdapter\11004_L1-AD_NoEquipment.log.22] -> [C:\01_Data\Main\Trunk\KDA\FC\Core\bin\Debug\LogAdapter\11004_L1-AD_NoEquipment.log.23]
      log4net: Moving [C:\01_Data\Main\Trunk\KDA\FC\Core\bin\Debug\LogAdapter\11004_L1-AD_NoEquipment.log.21] -> [C:\01_Data\Main\Trunk\KDA\FC\Core\bin\Debug\LogAdapter\11004_L1-AD_NoEquipment.log.22]
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            PavelKilik Pavel Kilik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: