mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 05:57:20 -04:00
Merge pull request #5062 from crobibero/delete_log_task
(cherry picked from commit 4d13cad7af
)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
parent
cdba6b3d35
commit
5cc8ed6516
1 changed files with 5 additions and 4 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue