Github user dpsenner commented on a diff in the pull request:
https://github.com/apache/logging-log4net/pull/13#discussion_r129869327
--- Diff: tests/src/Appender/RollingFileAppenderTest.cs ---
@@ -239,13 +251,50 @@ public void RollingCombinedWithPreserveExtension()
}
VerifyFileCount(2, true);
}
+ [Test]
+ public void RollingBySizePreserveExtensionAndWithFolder()
+ {
+ _root =
((Repository.Hierarchy.Hierarchy)Utils.GetRepository()).Root;
+ _root.Level = Level.All;
+ PatternLayout patternLayout = new PatternLayout();
+ patternLayout.ActivateOptions();
+
+ RollingFileAppender roller = new RollingFileAppender();
+ roller.StaticLogFileName = false;
+ roller.Layout = patternLayout;
+ roller.AppendToFile = true;
+ roller.RollingStyle =
RollingFileAppender.RollingMode.Size;
+ roller.MaxSizeRollBackups = 2;
+ roller.CountDirection = 1;
+ roller.PreserveLogFileNameExtension = true;
+ roller.MaximumFileSize = "5KB";
+ roller.File = c_fileNameWithFolder;
+ roller.ActivateOptions();
+ _root.AddAppender(roller);
+
+ _root.Repository.Configured = true;
+ for (int i = 0; i < 1000; i++)
+ {
+ StringBuilder s = new StringBuilder();
+ for (int j = 50; j < 100; j++)
+ {
+ if (j > 50)
+ {
+ s.Append(" ");
+ }
+ s.Append(j);
+ }
+ _root.Log(Level.Debug, s.ToString(), null);
+ }
+ VerifyFileCount(c_fileNameWithFolder,
roller.MaxSizeRollBackups + 1, true);
+ }
/// <summary>
/// Removes all test files that exist
/// </summary>
- private static void DeleteTestFiles()
+ private static void DeleteTestFiles(string baseFileName)
{
- ArrayList alFiles = GetExistingFiles(c_fileName);
+ ArrayList alFiles = GetExistingFiles(baseFileName);
alFiles.AddRange(GetExistingFiles(c_fileName,
true));
--- End diff --
Should this maybe read as?
```
ArrayList alFiles = GetExistingFiles(c_fileName);
alFiles.AddRange(GetExistingFiles(c_fileName, true));
alFiles.AdRange(GetExistingFiles(baseFileName));
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---