Skip to content

vscode-powershell logs rotation #5079

Closed

Description

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
    }

Activity

  1. added
    Issue-Enhancement
    Needs: Triage
    on Nov 1, 2024
  2. changed the title [-]Log rotation[/-] [+]`vscode-powershell` logs rotation[/+] on Nov 1, 2024
  3. JustinGrote commented on Nov 1, 2024

    @JustinGrote
    Collaborator

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

  4. removed
    Needs: Triage
    on Nov 1, 2024
  5. andyleejordan commented on Nov 4, 2024

    @andyleejordan
    Member

    Until then, they can be completely disabled so as to write no files. There's a setting somewhere, I definitely remember implementing that.

  6. JustinGrote commented on Nov 16, 2024

    @JustinGrote
    Collaborator

    Olav Rønnestad Birkeland (@o-l-a-v) the logs now rotate with VSCode. VSCode keeps the last 10 startup logs, you can use Open Extension Logs Folder command to access them quickly, and the powershell version has also been remapped to the specific powershell folder.

    Thanks for your suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions