case 4690 - NLog 6.2.2: archive suffix keeps log-ayanova-N.txt names and cleans up old archives; log viewer sorted by date

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 17:31:01 -07:00
parent 4098cd4922
commit 91f59d8554
4 changed files with 15 additions and 7 deletions

View File

@@ -117,7 +117,8 @@ namespace AyaNova.Api.Controllers
//Iterate all log files and build return
var files = System.IO.Directory.GetFiles(ServerBootConfig.AYANOVA_LOG_PATH, "log-ayanova*.txt");
var ret = files.Where(z => !z.EndsWith("ayanova.txt")).OrderByDescending(z => z).Select(z => System.IO.Path.GetFileName(z)).ToList();
//newest archive first by file date, archive numbers only increase since NLog 6 so name order breaks past 9
var ret = files.Where(z => !z.EndsWith("ayanova.txt")).OrderByDescending(z => System.IO.File.GetLastWriteTimeUtc(z)).Select(z => System.IO.Path.GetFileName(z)).ToList();
ret.Insert(0, "log-ayanova.txt");
return Ok(ApiOkResponse.Response(ret));
}