Page Summary
-
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
LoggerInterfacecan be specified for further customization.
The PHP client library conforms to PSR-3 for logging and provides a logger for gRPC calls.
The PSR-3 log 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 |
Configure logging
By default, each of the library loggers writes to STDERR on a
channel with the default name specified in
GoogleAdsClientBuilder using a Monolog
StreamHandler.
You can configure options for the default logger in your
google_ads_php.ini file:
[LOGGING]
; Optional logging settings.
logFilePath = "path/to/your/file.log"
logLevel = "INFO"
Ensure that the runtime PHP process has write permissions for the directory and
file specified in logFilePath.
If you need to further customize logging, you can specify your own custom logger
by providing a logger instance that implements the
LoggerInterface in GoogleAdsClientBuilder:
$googleAdsClient = (new GoogleAdsClientBuilder())
// ...
->withLogger(new MyCustomLogger())
->build();