The .NET client library logs requests, responses, and summary messages made to the Google Ads API. The logs may be written to a default logger in the .NET library, or a custom TraceListener.


You can enable logging by adding the following line in your Main method before making any API calls.

// Detailed logs.
    "C:\\logs\\details.log", System.Diagnostics.SourceLevels.All);

// Summary logs.
    "C:\\logs\\details.log", System.Diagnostics.SourceLevels.All);

Log Levels

The library will log different types of events to different log levels. On a successful API response, the summary will be logged at INFO, and the full request and responses will be logged at DEBUG. On a request that resulted in an API error, the summary message will be logged at WARN and the full request and response will be logged at INFO.

For partial failures, the partial failure details will be logged at DEBUG.

Advanced logging

In most cases, the logs generated by the client library should provide enough details to troubleshoot your issues. When reaching out to the support forum / aliases, you can either provide the logs (which redacts sensitive information by default), or just share the request ID (which is logged as part of the response log).

If you prefer capturing the request ID yourself, then you need to provide a GoogleResponseMetadata object to capture the request ID, as follows:

GoogleAdsResponseMetadata metadata = new GoogleAdsResponseMetadata(client.Config);

// Add the campaigns.
MutateCampaignsResponse retVal = campaignService.MutateCampaigns(
    customerId.ToString(), operations.ToArray(), metadata.CallSettings);


If the API log doesn't give you enough details, then you can enable more low level logging at grpc level. Keep in mind that this can get pretty detailed and long. The grpc logs are written to stderr, but you can attach your own logger like shown below. You can find all the supported environment variables here.

Environment.SetEnvironmentVariable("GRPC_VERBOSITY", "DEBUG");
Environment.SetEnvironmentVariable("GRPC_TRACE", "http");
GrpcEnvironment.SetLogger(new ConsoleLogger());