-
Notifications
You must be signed in to change notification settings - Fork 193
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
Error when displaying log from a previous VS Code run after restarting #1174
Comments
Thanks for reporting. I think the best thing to do would be to ensure the log file is saved to the query history location in the global storage. The problem manifests here: vscode-codeql/extensions/ql-vscode/src/queryserver-client.ts Lines 211 to 216 in cdb9506
Unfortunately, the logic is a bit twisted and we don't have the query history location available at the moment when we start writing the logs. It will require a little bit of reworking to get there. |
Indeed. I noticed this because I replicated the existing logic for some new options to display per-query structured logs and encountered this there too. I started looking into fixing this but I was actually going the opposite way and trying to figure out when a query comes from a previous run to hide the option. That isn't too easy to do either, so your solution is probably better. |
Let me take this over since this is related to work I've just done. I'll focus on the existing log and I'll make sure that whatever I do will be easily extendable to the structured log. |
Going through this now. The good news is that a lot of this logic can be significantly simplified since log files no longer need to be deleted when the workspace closes because they are deleted when the rest of the results are deleted. The bad (or complicating) news is that there is a preference I won't make any changes until we can discuss this some more. |
This sounds like a sensible option to me. The only reason that was added was because users wanted to retain logs after closing VS Code. If we're now in a position to store logs in a place that isn't deleted across restarts, there isn't really any need to keep that option. I'll wait to see what others think, though. In particular @shati-patel might have some thoughts as she worked on that feature if I remember rightly 🙂 |
Your reasoning sounds sensible to me! The custom log directory was in response to #820, which mentions "persisting logs across restarts" as the main use case. I agree it's fine to delete the |
Nice, thanks for digging up that issue. @tausbn as the original requester of that option, would you have any objections to its removal if we were now persisting logs across restarts until a query is deleted from the Query History? |
Here is how I am suggesting we handle the feature removal:
|
As long as said persistence works across restarts, including restarting a Codespaces instance, then I would be happy. Note that the current setup cannot even preserve the CLI across restarts/reconnects when Codespaces are involved. (I currently have to reinstall the CLI half a dozen times per day.) The reason the custom log directory worked for this purpose is that I could set it to a subdirectory of my Though, to be quite sure, I would need to understand what "[...] when the rest of the results are deleted." means. When exactly does this deletion occur? Also, due to their enormous size, I never actually open these logs in VSCode, but rather open them in the terminal using |
Results are kept around for 30 days by default and this value can be changed in your settings. These results will be retained in the query history view for your workspace. Also, manually removing results from the query history view also deletes them from disk.
Thanks for the idea. I will make sure it is easy to open log files outside of vscode. |
Describe the bug
After a restart, items in the Query History view preserved from previous runs still have a Show Query Log button when right-clicked. However, the query log is gone as it is stored in temporary storage that is cleared on restart, so clicking the button gives an error.
Version
Latest
main
of both CodeQL and VS Code.To reproduce
Expected behavior
Either we don't show Show Query Log any more, or we place the log somewhere where it is preserved across runs.
The text was updated successfully, but these errors were encountered: