The PHP client library conforms to PSR-3 for logging and provides a logger for gRPC calls.

The level at which messages are logged depends on whether the event succeeded.

Log message Success status Failure status
One-line summary INFO WARNING
Debug message (e.g., call queries) DEBUG NOTICE

Configuring logging

By default, each of the library loggers logs to STDERR on a channel with default name specified here using a Monolog StreamHandler.

You can configure some options for the default logger in the google_ads_php.ini file:

[LOGGING] ; Optional logging settings. logFilePath = "path/to/your/file.log" logLevel = "INFO"

If you need to further customize logging, you can specify your own logger entirely by providing a logger that implements the LoggerInterface in GoogleAdsClientBuilder:

$googleAdsClient = (new GoogleAdsClientBuilder())
    ->withLogger(new MyCustomLogger())