-
Notifications
You must be signed in to change notification settings - Fork 498
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
Add setting to allow for custom log path #1345
Comments
What OS? I've only used the PowerShell extension as a standard user on both Windows and Ubuntu and never had any problems with the extension writing to the logs dir. VSCode extensions are typically installed under the user's home dir where the user, running as a standard user, should have write perms. In fact, if the extension couldn't write to the |
The problem occurs when using application whitelisting. Putting the extensions folder where a user can write makes for complex white-listing scenarios. Putting the extensions folder where user can not write works for most extensions and allows for a simple path whitelisting. I see, then the sessions folder will be a problem as well. Will the extension only store data in the session or does it need to execute code from there? Would it be possible to alsp have the sessionpath configurable? |
Rather than adding multiple settings that require user configuration to make work in this scenario, perhaps we should write logs/session info to the user's appdata/local folder? If we did this, I'd also like to look at periodically deleting old log folders. Right now, we create a new log folder for every new session and pretty much the only way those get cleaned up now is when you update to a newer version of the extension (and the old version is removed). |
That sounds like a great idea! |
So who knows what the appropriate location for the session & log files would be for Linux and macOS? Or maybe we only make this change for Windows since app whitelisting is only an issue on Windows? Not sure I like having different ways of handling these files for different platforms. Thoughts? |
On macOS I think it's here: https://stackoverflow.com/questions/9495503/applications-data-folder-in-mac Linux is not so simple -- there's a few possible answers (https://unix.stackexchange.com/questions/65389/where-are-userspace-programs-supposed-to-save-their-logs, https://www.quora.com/What-is-the-best-Unix-Linux-directory-to-store-data-var-lib-etc-*something*-something-else, https://stackoverflow.com/questions/1510104/where-to-store-application-data-non-user-specific-on-linux). Somewhere under |
We could always use something like:
which works cross platform. But then we need a cleanup scenario. |
Couple that temp path with a subdir like |
@yume-chan Your issue there is probably orthogonal to controlling the log path. I think there are two problems you might be hitting:
The temp directory suggestion has a couple of issues:
If you've got time, can you please open a new issue about the large output of the logfiles you're experiencing? And/or wanting to periodically delete logs? @rkeithhill it feels like |
I tried to see if AppData was set in .NET on macOS and sadly, it's not.
TEMP was there on both. So the options seem to be:
I think there's also a 3rd option... if we have access to the normal path we're using now, keep it. If we can't write to it, then maybe we have a back up (temp or app data). Similar to the 2nd bullet but then maybe we'll be a bit more consistent than just doing things for different OS's. Any thoughts/opinions on these 3 points? |
Well my thinking is:
So my personal preference would be to use:
|
At least I think writing logs to your applications' "installation location" (for extensions, isn't the vscode extension folder their home?) is more unusual.
I personally feel comfortable when the OS can clean my unneeded files automatically. Applications should be more consistent with the OS, even if it means they will work differently on different OSs. I know it's cross-platform, but I don't think it should re-invent the wheel to create another self-styled behavior. One more merit to use the temp folder:Code is adding support for portable mode, ideally all extensions should follow and don't leave any file on the host machine. Code will write the temp folder path into (I assume this environment variable will also be set for the extension host process, but I haven't try it. So if I'm wrong, please point me out) EDIT: I know, and agree that temp folder is not a suitable path for logs, but at least it's easy to use. If it's not easily accessible for the user, the extension can create their own log folder in the temp folder, then add a command to quickly open it for the user. |
Agreed there - I'm suggesting we should consider writing logs to conventional application data folders instead. Not saying I'm against writing to a temp folder, just want to make it clear that I wasn't saying we should write to the install location -- in fact I think we shouldn't do that. |
A couple of notes on the temp folder situation:
|
@rjmholt can you check on CentOS 7, |
Ubuntu 16.04 also returns that result |
Looks like VSCode added something that tells extensions where they can store logs. From the release notes:
|
That's really cool! |
Looks like the default settings for the log path API are here: https://github.com/Microsoft/vscode/blob/f3b191ab38fb9f1717ce5ce3396bb41204ffb399/src/paths.js#L18-L25 Those should all be deleteable for users I imagine |
Hey @SimonWahlin, I know this issue is from 2018 but I was looking through old, highly-commented issues and stumbled upon it. I wanted to let you know that in recent versions of the extension with #4240, the log path is now set to use VS Code's
So this should no longer be a problem. If it is you can now also disable all logging via: "powershell.developer.editorServicesLogLevel": "None" Thanks! |
This issue has been marked as fixed. It has been automatically closed for housekeeping purposes. |
Summary of the new feature
Running VSCode as a non-administrator I don't have write-access to the extensions folder.
This causes the PowerShell extension to fail to load when trying to write to the logs subfolder of the PowerShell extension folder.
To be able to load the extension without write-access to the extensions directory I would like to configure the extension to either turn of logging completely or configure the path to the logs folder to a folder where the user has write access.
Proposed technical implementation details (optional)
Any or all of the following:
The text was updated successfully, but these errors were encountered: