Logging

  • The PHP client library supports logging for gRPC calls according to PSR-3 standards.

  • The logging level depends on whether the event succeeded, with different levels for success and failure statuses.

  • Default logging outputs to STDERR with configurable options in google_ads_php.ini, including log file path and level.

  • Custom loggers implementing LoggerInterface can be specified for further customization.

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())
    ->build();