grpc-node icon indicating copy to clipboard operation
grpc-node copied to clipboard

Update logs usage on troubleshooting guide

Open diogotorres97 opened this issue 3 years ago • 6 comments

Since GRPC_VERBOSITY=debug is not enough to see the logs, it is needed to update the troubleshooting guide to include GRPC_TRACE=all.

Related issues: https://stackoverflow.com/a/60935367

Something like:

## GRPC_VERBOSITY

`GRPC_VERBOSITY` is used to set the minimum level of log messages printed by gRPC (supported values are `DEBUG`, `INFO` and `ERROR`). If this environment variable is unset, only `ERROR` logs will be printed.

**Note**: This environment variable only works if `GRPC_TRACE` is set.

## GRPC_TRACE

`GRPC_TRACE` can be used to enable extra logging for some internal gRPC components. Enabling the right traces can be invaluable
for diagnosing for what is going wrong when things aren't working as intended. Possible values for `GRPC_TRACE` are listed in [Environment Variables Overview](doc/environment_variables.md).
Multiple traces can be enabled at once (use comma as separator).


# Enable debug logs for an application
GRPC_VERBOSITY=debug GRPC_TRACE=all ./helloworld_application_using_grpc


diogotorres97 avatar Dec 13 '22 14:12 diogotorres97

There are actually a couple of logs that are output without any tracers, but they're rare. A significant amount of the information you are looking for can be found in the environment variables doc, but I agree that it would be good to say more about the relationship between those two environment variables.

murgatroid99 avatar Dec 16 '22 15:12 murgatroid99

(grpc-js version: 1.12.2) I added the following setting of environment variables at the beginning of my js entrypoint:

process.env.GRPC_VERBOSITY = 'DEBUG'; process.env.GRPC_TRACE = 'all';

but no extra logging or traces are output to stderr (in particular I don't see them in the docker console log).

PversusNP avatar Oct 31 '24 14:10 PversusNP

The library only reads those environment variables when it is initially loaded. If those lines were executed after that, they would have no effect. I would recommend instead setting them in your docker execution arguments.

murgatroid99 avatar Oct 31 '24 16:10 murgatroid99

Thank you very much, now I can see extra logs. But they doesn't look enough. I'm trying to debug why my client connection fails, and server side, with GRPC_VERBOSITY=DEBUG and GRPC_TRACE=all, I only get: D 2024-11-04T08:18:58.491Z | v1.12.2 7 | server | (1) Connection established by client 192.168.0.254:58047 No other info about service calling and completing the connection. Should I set different verbosity or trace level?

PversusNP avatar Nov 04 '24 08:11 PversusNP

If you want to know why the client connection fails, you will get more information looking at the logs from the client. That log shows that from the point of view of the server the client connection succeeded, and that the server didn't receive any requests from that client. That's all the server knows, so that's all it can tell you in the logs.

murgatroid99 avatar Nov 04 '24 17:11 murgatroid99

Thank you @murgatroid99 you confirmed what I was turning out. It helps me to investigare further.

PversusNP avatar Nov 05 '24 07:11 PversusNP