Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode-powershell logs rotation #5079

Open
2 tasks done
o-l-a-v opened this issue Nov 1, 2024 · 1 comment
Open
2 tasks done

vscode-powershell logs rotation #5079

o-l-a-v opened this issue Nov 1, 2024 · 1 comment
Labels
Issue-Enhancement A feature request (enhancement).

Comments

@o-l-a-v
Copy link
Contributor

o-l-a-v commented Nov 1, 2024

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.

Summary

Would be great if vscode-powershell could rotate its own log files, as in delete logs older than X days. Maybe a sane default would be 30 days, with a overridable setting in settings.json? Or only keep X latest logs no matter date and time, maybe 20?

PS > Get-ChildItem -Directory -Path ('{0}\Code\User\globalStorage\ms-vscode.powershell\logs' -f $env:APPDATA) |
    Sort-Object -Property 'LastWriteTime' |
    Select-Object -First 1 -Last 1

    Directory: C:\Users\olav.birkeland\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          28.09.2022    15:02                1664370174-9c0cd76c-5603-4542-9722-a56b3e73645a1664370154962
d----          01.11.2024    10:40                1730454055-b57d49db-d6c5-49b0-8239-a5cd952e2a651730454050247

PS >

Ref: https://github.com/PowerShell/vscode-powershell/blob/main/docs/troubleshooting.md#logs

Proposed Design

Get-ChildItem -Directory -Path ('{0}\Code\User\globalStorage\ms-vscode.powershell\logs' -f $env:APPDATA) |
    Sort-Object -Property 'LastWriteTime' -Descending |
    Select-Object -Skip 30 |
    ForEach-Object -Process {
        $null = Remove-Item -Path $_.'FullName' -Recurse
    }
@o-l-a-v o-l-a-v added Issue-Enhancement A feature request (enhancement). Needs: Triage Maintainer attention needed! labels Nov 1, 2024
@o-l-a-v o-l-a-v changed the title Log rotation vscode-powershell logs rotation Nov 1, 2024
@JustinGrote
Copy link
Collaborator

I'm currently updating the logging to use the LogOutputChannel, which does automatic rotation.
#5065

@JustinGrote JustinGrote removed the Needs: Triage Maintainer attention needed! label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

2 participants