csharp-language-server-protocol icon indicating copy to clipboard operation
csharp-language-server-protocol copied to clipboard

Enable the ability to log the payloads on the server side

Open TylerLeonhardt opened this issue 6 years ago • 7 comments

In the PowerShell extension, we ask users to upload the logs that all come from a central folder. This includes:

  • client logs (vscode-powershell)
  • startup logs before the language server is up
  • language server logs (PowerShell Editor Services)

This includes everything including payloads. We also have 1 setting that handles what is included in the logs:

powerShell.developer.logLevel

That maps to a log level in the server.

Since csharp-lsp doesn't give us the ability to log the payload server side, we will have to adapt to a more complicated logging story... relying on the user to use both powerShell.developer.logLevel and powershell.trace.server in order to get verbose logs from the vscode client side.

Also, we will have to tell the user to copy language server logs from the output window, and attach the other logs from the file system. It's messy.

If csharp-lsp exposed a way to include payloads in logging, then we would be able to keep our simple system that folks already know.

TylerLeonhardt avatar Oct 06 '19 19:10 TylerLeonhardt

I added this functionality to the client's implementation of LspConnection a while back so it shouldn't be too hard retrofit to the server-side LspConnection.

The tricky part, server-side, would be preventing a log-loop; the LanguageServerLogger needs to detect - possibly via an AsyncLocal<T> or something - that it's logging a message generated by the LspConnection component and not submit a log message for transmission 😁

tintoy avatar Oct 06 '19 21:10 tintoy

(really, at some point, the 2 implementations of LspConnection should be reintegrated - having 2 implementations of the send / receive / serialisation logic just doubles the maintenance workload 😉)

tintoy avatar Oct 06 '19 21:10 tintoy

The tricky part, server-side, would be preventing a log-loop

Yes! That is tricky. I guess, Log messages don't need to be logged (as odd as that sounds...)

TylerLeonhardt avatar Oct 06 '19 23:10 TylerLeonhardt

side note, I think if this VS Code issue was resolved, I'd feel a lot more comfortable depending on the output windows... but since that's not really a thing, telling the user to "copy paste these files" seems a lot easier than "copy the following Output windows: X, Y, Z"

TylerLeonhardt avatar Oct 07 '19 20:10 TylerLeonhardt

@TylerLeonhardt did this get resolved with https://github.com/PowerShell/PowerShellEditorServices/pull/1066?

david-driscoll avatar Mar 30 '20 03:03 david-driscoll

No that added our logs to a file, but the payload of the LSP requests are not added to those logs.

I can only see the payload in the output pane using the "powershell editor services.trace.server":"verbose" setting

TylerLeonhardt avatar Mar 30 '20 04:03 TylerLeonhardt

ohhhhhhhhhh, okay I'm slow. You're looking for the payloads themselves to be output, okay. That will take some thinking. Thanks!

david-driscoll avatar Mar 30 '20 04:03 david-driscoll