mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
fix delete log task
This commit is contained in:
parent
01836e55e4
commit
6abee2dd22
@ -80,10 +80,11 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
||||
// Delete log files more than n days old
|
||||
var minDateModified = DateTime.UtcNow.AddDays(-_configurationManager.CommonConfiguration.LogFileRetentionDays);
|
||||
|
||||
// Only delete the .txt log files, the *.log files created by serilog get managed by itself
|
||||
var filesToDelete = _fileSystem.GetFiles(_configurationManager.CommonApplicationPaths.LogDirectoryPath, new[] { ".txt" }, true, true)
|
||||
.Where(f => _fileSystem.GetLastWriteTimeUtc(f) < minDateModified)
|
||||
.ToList();
|
||||
// Only delete files that serilog doesn't manage (anything that doesn't start with 'log_'
|
||||
var filesToDelete = _fileSystem.GetFiles(_configurationManager.CommonApplicationPaths.LogDirectoryPath, true)
|
||||
.Where(f => !f.Name.StartsWith("log_", StringComparison.Ordinal)
|
||||
&& _fileSystem.GetLastWriteTimeUtc(f) < minDateModified)
|
||||
.ToList();
|
||||
|
||||
var index = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user