-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
file-archivingIssues with archiving with the file targetIssues with archiving with the file targetfile-targetquestion
Milestone
Description
NLog version: 6.0.3
Platform: .NET9 + Windows10
Current NLog config (C#)
// Nlog version: 6.0.3
// Nlog config:
NLog.LogManager.Setup().LoadConfiguration(builder =>
{
builder
.ForLogger(loggerNamePattern: "*")
.FilterMinLevel(LogLevel.Trace)
.WriteToFile(fileName: "${basedir}/logs/test.log",
archiveAboveSize: 1024 *10,
maxArchiveFiles: 10
);
});
// Logger
var logger_test = LogManager.GetLogger("abc");
// Loop test
string msg = string.Concat(Enumerable.Repeat("ABCDEF", 200));
int loop = 0;
while (true)
{
Console.WriteLine("press any key to log...");
Console.ReadKey(true);
Parallel.For(0, 1000, i =>
{
// to log
logger_test.Trace(msg);
});
Console.WriteLine($"loop-{++loop} completed");
}
Test result:
loop-1 completed:
file list(10):
test_91.log ... test99.log,
test_111.log -----Q: Why is it 111? Why not 100?
loop-2 completed:
file list(10):
test_91.log ... test99.log,
test_222.log -----Q: Why is it 222? And why not delete the older log-files?
The old files or old serial numbers were not deleted; instead, the new files were deleted. Why??
This seems to be a bug.. Or did I use it incorrectly? Who can tell me how to correct it?
Metadata
Metadata
Assignees
Labels
file-archivingIssues with archiving with the file targetIssues with archiving with the file targetfile-targetquestion