From 113fc0d418f39b776c878a40c19bf93a217da8ff Mon Sep 17 00:00:00 2001 From: mdaneri Date: Mon, 3 Mar 2025 06:30:54 -0800 Subject: [PATCH] Squashed changes from PR #1507 --- src/Private/Logging.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Private/Logging.ps1 b/src/Private/Logging.ps1 index 394311e4a..3b35edb35 100644 --- a/src/Private/Logging.ps1 +++ b/src/Private/Logging.ps1 @@ -63,10 +63,10 @@ function Get-PodeLoggingFileMethod { $item.ToString() | Out-File -FilePath $path -Encoding utf8 -Append -Force # if set, remove log files beyond days set (ensure this is only run once a day) - if (($options.MaxDays -gt 0) -and ($options.NextClearDown -lt [DateTime]::Now.Date)) { + if (($options.MaxDays -gt 0) -and ($options.NextClearDown -le [DateTime]::Now.Date)) { $date = [DateTime]::Now.Date.AddDays(-$options.MaxDays) - $null = Get-ChildItem -Path $options.Path -Filter '*.log' -Force | + $null = Get-ChildItem -Path $options.Path -Filter "$($options.Name)_*.log" -Force | Where-Object { $_.CreationTime -lt $date } | Remove-Item -Force