From 3575b8c8c51742af1310bc6176ee32b2cb76480c Mon Sep 17 00:00:00 2001 From: tanvi-jagtap Date: Mon, 24 Jun 2024 07:48:11 +0000 Subject: [PATCH] [Gpr_To_Absl_Logging] Fix docs --- TROUBLESHOOTING.md | 24 +++++++++++++++++++----- doc/environment_variables.md | 5 ++--- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md index b2b30196535..4f0ae6f4918 100644 --- a/TROUBLESHOOTING.md +++ b/TROUBLESHOOTING.md @@ -16,26 +16,32 @@ Verbosity can be set using absl flags such as These can also be programmatically set using [these absl APIs.](https://github.com/abseil/abseil-cpp/blob/master/absl/log/globals.h) +Example +``` +# Disable all logs other than FATAL for the entire application +./helloworld_application_using_grpc --v=-1 --minloglevel=3 +``` + ## GRPC_VERBOSITY (DEPRECATED) [Environment Variables Overview](doc/environment_variables.md) ## GRPC_TRACE -`GRPC_TRACE` can be used to enable extra logging for some internal gRPC components. Enabling the right traces can be invaluable +`GRPC_TRACE` can be used to enable extra logging for specific 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 here](doc/trace_flags.md). Multiple traces can be enabled at once (use comma as separator). ``` -# Enable debug logs for an application +# Enable debug logs for the entire application ./helloworld_application_using_grpc --v=2 --minloglevel=0 ``` ``` # Print information about invocations of low-level C core API. -# Note that trace logs of log level DEBUG won't be displayed. -# Also note that many tracers user log level INFO, -# so without setting absl verbosity accordingly, no traces will be printed. +# Note that trace logs that use `VLOG` won't be displayed. +# Many tracers user log level INFO. +# So unless absl settings are correct, no traces will be printed. GRPC_TRACE=api ./helloworld_application_using_grpc --v=-1 --minloglevel=0 ``` @@ -49,3 +55,11 @@ Known limitations: `GPRC_TRACE=tcp` is currently not implemented for Windows (yo Please note that the `GRPC_TRACE` environment variable has nothing to do with gRPC's "tracing" feature (= tracing RPCs in microservice environment to gain insight about how requests are processed by deployment), it is merely used to enable printing of extra logs. + +## Preventing gRPC Log Noise + +Log noise could consume a lot of resources. We recommend tuning settings for production systems very carefully. +* Avoid using GRPC_VERBOSITY flag. This has been deprecated. If this value of this flag is anything other than "ERROR" or "NONE" it will cause log noise. +* Always avoid setting --v and --vmodule to anything other than -1 for production systems. +* Avoid setting --minloglevel=0 for production systems. Anyting greater than 0 should be fine. +* If setting this does not eliminate your log noise, look for instances of functions `--v`, `--vmodule`, `absl::SetVLogLevel` and `absl::SetMinLogLevel` in your entire codebase and any libraries/components/configs that you may be using. diff --git a/doc/environment_variables.md b/doc/environment_variables.md index 13fb0e2fa82..1f4da4d53ed 100644 --- a/doc/environment_variables.md +++ b/doc/environment_variables.md @@ -62,9 +62,8 @@ some configuration as environment variables that can be set. - If nothing is set as GRPC_VERBOSITY, then the setting of the exernal application will be honoured. - If nothing is set by the external application also, the default set by absl will be honoured. -* GRPC_STACKTRACE_MINLOGLEVEL - Minimum loglevel to print the stack-trace - one of DEBUG, INFO, ERROR, and NONE. - NONE is a default value. +* GRPC_STACKTRACE_MINLOGLEVEL (DEPRECATED) + This will not work anymore. * GRPC_TRACE_FUZZER if set, the fuzzers will output trace (it is usually suppressed).