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

Logger doesn't work anymore #1306

Closed
divyenduz opened this issue Feb 4, 2020 · 16 comments
Closed

Logger doesn't work anymore #1306

divyenduz opened this issue Feb 4, 2020 · 16 comments

Comments

@divyenduz
Copy link
Contributor

From the graphql-language-service-server package (at least, could be shared further).

It used to work before the TS rewrite but now logger emits nothing when connected to say VSCode extension now.

process.stderr.write seems to work though.

@acao
Copy link
Member

acao commented Feb 4, 2020

thanks for reporting, good to know! i'll take a look here today and be sure to have it fixed before the next alpha

@divyenduz
Copy link
Contributor Author

On the subject of alpha, IDK if it is automated or not, my current workflow is to find the latest alpha via npm info graphql-language-service-server (or some package) and use it, probably worth documenting.

@acao
Copy link
Member

acao commented Feb 5, 2020

you can also do npm i graphql-language-service-server@next

@yoshiakis
Copy link
Collaborator

yoshiakis commented Feb 11, 2020

In my local environment, even if I use the version of 2.4.0-alpha.1 of graphql-language-service-service, logger emits a log file under the temp folder. I tested it following the pattern A except step 7. I'll try the step 7 later.

@yoshiakis
Copy link
Collaborator

yoshiakis commented Feb 12, 2020

I tried the step 7 using the version of 2.4.0-alpha.1 of graphql-language-service-service and any logs didn't appear in output section under GraphQL Language Server (although the document says it's GraphQL Language Service). However, I also tried it using the version of 2.3.3, which is before the TS rewrite, and the result is the same, which is that any logs didn't appear!

BTW, I used master branch of vscode-graphql to check these.

@acao
Copy link
Member

acao commented Feb 12, 2020

yes i will be getting around to this bug, was trying to identify where the regression originally happened

@yoshiakis
Copy link
Collaborator

yoshiakis commented Feb 19, 2020

@divyenduz Do you mean Logger doesn't emit log file in a temp folder or it doesn't emit log in output section under GraphQL Language Service in vscode?

@acao
Copy link
Member

acao commented Feb 19, 2020

I think that it’s also a lack of stdout?

@divyenduz
Copy link
Contributor Author

@divyenduz Do you mean Logger doesn't emit log file in a temp folder or it doesn't emit log in output section under GraphQL Language Service in vscode?

Yes that is what I meant

@yoshiakis
Copy link
Collaborator

@divyenduz Isn't a log file created under ${TMPDIR}/graphql-language-service-logs directory when you follow this set-up A and run and debug vscode-graphql extension?

@divyenduz
Copy link
Contributor Author

@yoshiakis How do I find the TMPDIR path?

Also, the way it used to work was that the logs appeared in the VSCode Language Client's OutputChannel.

Visually, it should appear here:

CleanShot 2020-03-14 at 18 49 43@2x

As you can see, it still shows this one liner message for cmd + click on a symbol. It used to show all sorts of things like hover on a symbol (the whole LSP request/responses)

@acao
Copy link
Member

acao commented Mar 14, 2020

@divyenduz want to pair on this real quick?

@divyenduz
Copy link
Contributor Author

divyenduz commented Mar 14, 2020

This one seems to work because in graphql-language-service-* it is a process.stderr.write

process.stderr.write(`Definition not found for GraphQL type ${name}`);

Want to pair on this real quick?

In 10-20 minutes maybe?

@acao
Copy link
Member

acao commented Mar 14, 2020

@divyenduz and I had a session and tried to track down what changed in graphql-languagesrver and client from 3.5.1. My guess is that the language server no longer writes to stderr as it did before, and somewhere in vscode-jsonrpc this changed over major versions. we decided manually writing to stderr in the Logger._log() will fix it for now, but it would be great to know why this regression occurred

acao added a commit that referenced this issue Mar 14, 2020
seems that vscode-languageserver deprecated writing to stderr by default
@divyenduz
Copy link
Contributor Author

divyenduz commented Mar 14, 2020

acao added a commit that referenced this issue Mar 14, 2020
seems that vscode-languageserver deprecated writing to stderr by default
@divyenduz
Copy link
Contributor Author

I think we figured this out! It works now, there are random "undefined" in logs but that is a separate issue 🙌

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

3 participants