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

Do not show complete content after reload if output is cleared #204946

Closed
nhedger opened this issue Feb 11, 2024 · 5 comments
Closed

Do not show complete content after reload if output is cleared #204946

nhedger opened this issue Feb 11, 2024 · 5 comments
Assignees
Labels
feature-request Request for new features or functionality log VS Code log issues

Comments

@nhedger
Copy link

nhedger commented Feb 11, 2024

Type: Bug

I'm building an extension that uses the LogOutputChannel to output some logs when the extension activates.

I started noticing that everytime I reloaded the window, I'd end up with the same logs twice: the logs from the previous activation, and the logs from the current activation.

I assumed that the channel wasn't cleared automatically so at first I manually cleared the output channel using the context menu action before reloading the window. Unfortunately, this still results in the logs from the previous activation being shown. Programmatically clearing the output channel using the clear method did not work either.

The only way I could the channel to clear was to completely restart VS Code.

I'm thinking maybe the buffer is not being cleared and when the window is reloaded, the logs from the current activation are appended to the logs from the previous one.

VS Code version: Code 1.86.1 (31c37ee, 2024-02-07T09:09:01.236Z)
OS version: Darwin x64 23.2.0
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz (16 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 2, 3, 3
Memory (System) 32.00GB (7.05GB free)
Process Argv
Screen Reader no
VM 0%
Screen.Recording.2024-02-11.at.18.51.26.mov
@sandy081
Copy link
Member

It is designed that logs are retained on window reload

@sandy081 sandy081 added the *as-designed Described behavior is as designed label Feb 13, 2024
@nhedger
Copy link
Author

nhedger commented Feb 13, 2024

I understand persisting the logs between window reloads, but why persist them after having explicitly cleared them? This certainly feels counterintuitive.

@sandy081
Copy link
Member

but why persist them after having explicitly cleared them

Good point.

@sandy081 sandy081 changed the title LogOutputChannel not cleared properly Do not show complete content after reload if output is cleared Feb 19, 2024
@sandy081 sandy081 added feature-request Request for new features or functionality log VS Code log issues and removed *as-designed Described behavior is as designed labels Feb 19, 2024
@sandy081 sandy081 added this to the Backlog Candidates milestone Feb 19, 2024
@nhedger
Copy link
Author

nhedger commented Aug 2, 2024

Should this be reopened?

@Splines
Copy link

Splines commented Oct 31, 2024

As discussed in #232500, the behavior with regards to the log file written to disk is also different on WSL compared to MacOS:

const logger = vscode.window.createOutputChannel("My extension", { log: true });
  • Use Developer: Open Log File to open the log file for My extension.
  • On Linux (WSL2 Ubuntu), we observe that after a Developer: Reload Window, when using Open Log File again, a new log file is opened that VSCode neatly created for us in the folder exthost<some_number+1>. Here, <some_number is the number for the folder in which the log file resided prior to the window reload.
  • However, on MacOS (Darwin 23.6.0 arm64), we notice that the same logfile is reused and lines are only appended to it. Is there a way we can force a new log file to be created on this system as well? Or at least that the old logfile is cleared? logger.clear() or logger.dispose() does not seem to work, it only clears the log from the output pane but does not affect the log file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality log VS Code log issues
Projects
None yet
Development

No branches or pull requests

5 participants