Hello,

I need to delete old logs with date rolling style. This is not implemented so, I am writing a little patch on the last beta version.

There is the current patch in attachement.

Are you interested by this sort of patch ? (or it's more appropriate that I add my own new Appender ?)

Thanks,

--
Florian.

Do not meddle in the affairs of browsers, for they are subtle and quick to 
anger - Tolkien

453a454,484
>                               if (m_rollDate && m_maxSizeRollBackups != 0)
>                               {
>                                       FileInfo fi = new FileInfo(File);
>                                       string shortFileName = fi.Name;
>                                       string dirName = fi.DirectoryName+"\\";
> 
>                                       string[] validFilesName = new 
> string[m_maxSizeRollBackups];
>                                       for(int i=0; i<m_maxSizeRollBackups; 
> i++)
>                                       {
>                                               string dateFormat = 
> m_now.AddDays(-i).ToString(m_datePattern, 
> System.Globalization.DateTimeFormatInfo.InvariantInfo);
>                                               validFilesName[i] = 
> shortFileName + dateFormat;
>                                       }
> 
>                                       foreach( string current in 
> GetExistingFiles(File) )
>                                       {
>                                               bool valid = false;
>                                               foreach( string validFileName 
> in validFilesName )
>                                               {
>                                                       if ( 
> validFileName.Equals(current) )
>                                                       {
>                                                               valid = true;
>                                                               break;
>                                                       }
>                                               }
>                                               if (valid==false)
>                                               {
>                                                       DeleteFile( 
> dirName+current );
>                                               }
>                                       }
>                               }
> 

Reply via email to