AI-generated Key Takeaways
-
Google Ads API requests and responses can be logged using either a custom logger or the default client library logger in Perl.
-
The library logs successful API responses at INFO (summary) and DEBUG (full details), while logging API errors at WARN (summary) and INFO (full details).
-
The client library uses a
GoogleAdsLogger
class with a default configuration that logs to files in alogs
folder, which can be customized with alog4perl.conf
file. -
Logging can be enabled or disabled for summary and detail logs using specific methods of the
GoogleAdsLogger
class.
Requests, responses, and summary messages made to the Google Ads API can be logged with your own custom logger or the default logger in the client library for Perl.
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
.
Log type | Log name | Success level | Failure level |
---|---|---|---|
SUMMARY | Google.Ads.GoogleAds.Summary | INFO | WARN |
DETAIL | Google.Ads.GoogleAds.Detail | DEBUG | INFO |
For partial failures, the partial failure details will be logged at DEBUG
.
Configuration
The client library uses a custom class for all logging purposes and is exposed
through the GoogleAdsLogger
module. This class provides a default configuration that both summary and detail
loggers will log to relative files in the logs
folder under your HOME
directory.
But the default configuration can be overridden by providing a
log4perl.conf
file in your HOME
directory.
Logging can be enabled/disabled using the following methods:
Enables logging for both loggers.
Google::Ads::GoogleAds::Logging::GoogleAdsLogger::enable_all_logging();
Disables the summary logging.
Google::Ads::GoogleAds::Logging::GoogleAdsLogger::disable_summary_logging();
Disables the detail logging.
Google::Ads::GoogleAds::Logging::GoogleAdsLogger::disable_detail_logging();
You can use the methods of the GoogleAdsLogger
class directly for even more
control over how requests are logged.