grpc c++ write log to file

46 views
Skip to first unread message

city invoker

unread,
Oct 29, 2023, 8:56:23 AM10/29/23
to grpc.io
how can i write req/rsp info to a log file,with tracking request_id,i look at the grpcpp source code and found not support, i'm using c++ btw.

Eugene Ostroukhov

unread,
Nov 7, 2023, 1:13:13 PM11/7/23
to grpc.io
I am not sure what request_id you mean. You may get textual representation of the request or response by calling the DebugString message. ABSL log also has built-in support for proto messages:

::envoy::service::discovery::v3::DiscoveryRequest req;
req.add_resource_names("aaa");
gpr_log(GPR_ERROR, "%s", req.DebugString().c_str());
LOG(ERROR) << "ABSL log!" << req;

Reply all
Reply to author
Forward
0 new messages