Regarding grpc logging [C++]

288 views
Skip to first unread message

vinay Nayak

unread,
Mar 25, 2023, 12:33:16 PM3/25/23
to grpc.io
Hi, have recently started working on grpc v1.52.1 using C++ on linux platform.
Found out that gpr_log function is being used for logging mechanism.
Was looking for redirecting gpr_logs to any given file by user so that can be analyzed later if any need arises. Is it supported in the above grpc version for C++ on linux.

When looked at code, it is printing all grpc logs to std_err. 
Also, found out that for php there is an option to mention the log file using variable "grpc.log_filename"

Can any one confirm, does "logs redirecting to file" is supported for c++ language also ? If so, how to enable it ?

 

yas...@google.com

unread,
Mar 29, 2023, 1:43:13 PM3/29/23
to grpc.io
There are ways to redirect stderr process-wide, but that's probably not what you are looking for. We don't have a C++ API for overriding the default log mechanism. We do have a gRPC Core API to set the logging function though - https://github.com/grpc/grpc/blob/2cd1501ca5ec0cf7db9fd63dd07508b54eaf8d4d/include/grpc/support/log.h#L85
Note that this API is not considered stable and is subject to change.

Reply all
Reply to author
Forward
0 new messages