blob: 6ef4801528df99c9a2378dd1c18e3da3e6ef0e8e [file] [log] [blame] [view]
Jan Tattermuschc81a4652018-07-06 14:46:20 +02001# Troubleshooting gRPC
2
3This guide is for troubleshooting gRPC implementations based on C core library (sources for most of them are living in the `grpc/grpc` repository).
4
Jan Tattermuscha811fd62018-07-06 14:46:40 +02005## Enabling extra logging and tracing
Jan Tattermuschc81a4652018-07-06 14:46:20 +02006
7Extra logging can be very useful for diagnosing problems. All gRPC implementations based on C core library support
8the `GRPC_VERBOSITY` and `GRPC_TRACE` environment variables that can be used to increase the amount of information
9that gets printed to stderr.
10
11## GRPC_VERBOSITY
12
Jan Tattermusch4eb44f32018-07-09 09:39:01 +020013`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.
Jan Tattermuschc81a4652018-07-06 14:46:20 +020014
15## GRPC_TRACE
16
17`GRPC_TRACE` can be used to enable extra logging for some internal gRPC components. Enabling the right traces can be invaluable
Jan Tattermusch4eb44f32018-07-09 09:39:01 +020018for 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).
Jan Tattermuschc81a4652018-07-06 14:46:20 +020019Multiple traces can be enable at once (use comma as separator).
20
21```
22# Enable debug logs for an application
23GRPC_VERBOSITY=debug ./helloworld_application_using_grpc
24```
25
26```
Jan Tattermusch4eb44f32018-07-09 09:39:01 +020027# Print information about invocations of low-level C core API.
28# Note that trace logs of log level DEBUG won't be displayed.
29# Also note that most tracers user log level INFO, so without setting
30# GPRC_VERBOSITY accordingly, no traces will be printed.
31GRPC_VERBOSITY=info GRPC_TRACE=api ./helloworld_application_using_grpc
Jan Tattermuschc81a4652018-07-06 14:46:20 +020032```
33
34```
35# Print info from 3 different tracers, including tracing logs with log level DEBUG
36GRPC_VERBOSITY=debug GRPC_TRACE=tcp,http,api ./helloworld_application_using_grpc
37```
38
39Known limitations: `GPRC_TRACE=tcp` is currently not implemented for Windows (you won't see any tcp traces).
40
Jan Tattermusch4eb44f32018-07-09 09:39:01 +020041Please note that the `GRPC_TRACE` environment variable has nothing to do with gRPC's "tracing" feature (= tracing RPCs in
Jan Tattermuschc81a4652018-07-06 14:46:20 +020042microservice environment to gain insight about how requests are processed by deployment), it is merely used to enable printing
43of extra logs.