diff options
| author | crobibero <cody@robibe.ro> | 2021-01-18 19:42:50 -0700 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2021-01-18 19:42:50 -0700 |
| commit | 6abee2dd221b81a4651745ef959fbf590c82c280 (patch) | |
| tree | ae4c556c819402d06ef31953712b4c2920d48e91 | |
| parent | 01836e55e4c0a68500452d604a8a22bd919e590d (diff) | |
fix delete log task
| -rw-r--r-- | Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs index 184d155d4..fedb5deb0 100644 --- a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs +++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs @@ -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; |
