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:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user