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 creates log files in the config directory and these accumulate ad infinitum #213322

Open
triplespark opened this issue May 23, 2024 · 3 comments
Assignees

Comments

@triplespark
Copy link

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.85.2, applies to any current version AFIK
  • OS Version: Linux

Description: By default, VSCode creates log files at the location ~/.config/Code/logs/, e.g. /home/username/.config/Code/logs/20240522T223215/window1/renderer.log This is not a proper location for log files and they never get cleaned up. The .config directory is for configuration and meant to be backed up by the user. It is not meant to be filled with logs by the application.

I've noticed the issue because platformio generated hundrets of MBytes of logs in merely a few hours, all of them looking like "2024-05-22 22:42:50.155 [error] [Extension Host] Errored result: [object Object]". These occuring in that frequency and being completely useless at the same time is a different topic. However, a misbehavior can easily fill hard drives in completely unexpected locations.

Steps to Reproduce: Check your config dir see how many MBytes of logs you have in there.

Solution: The log directory should, by default, be placed somewhere else, e.g. in /tmp/.code-username/ or using mkstemp(). Observe practices how to create temporary files to avoid issues. For instance "/tmp/.code-username" might already exist and/or be a file or symlink to something else.

@VSCodeTriageBot
Copy link
Collaborator

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.89.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@triplespark
Copy link
Author

It is also present in the latest version.

@daiyam
Copy link
Contributor

daiyam commented May 23, 2024

I can also confirm the issue with 1.89.1.
It's due to how the default logsHome is computed:

this.args.logsPath = join(this.userDataPath, 'logs', key);

On Windows and macOS, it's fine.
On Linux, the logs shouldn't be placed in the .config directory.

It should be placed in $XDG_STATE_HOME($HOME/.local/state) instead of $XDG_CONFIG_HOME.
Reference: https://specifications.freedesktop.org/basedir-spec/latest/ar01s03.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants