Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
A biblioteca de cliente PHP está em conformidade com o PSR-3 para
registro em log e fornece um registrador para chamadas gRPC.
O nível em que as mensagens são
registradas depende se o evento foi bem-sucedido.
Mensagem de registro
Status de sucesso
Status de falha
Resumo de uma linha
INFO
AVISO
Mensagem de depuração (por exemplo, consultas de chamadas)
DEBUG
AVISO
Configurar o registro
Por padrão, cada um dos loggers da biblioteca registra em
STDERR em um
canal com o nome padrão especificado
aqui
usando um Monolog
StreamHandler.
É possível configurar algumas opções para o registrador padrão no arquivo
google_ads_php.ini:
[LOGGING] ; Configurações de geração de registros opcionais. logFilePath = "path/to/your/file.log"
logLevel = "INFO"
Se você precisar personalizar ainda mais o registro, especifique seu próprio logger
fornecendo um logger que implemente o
LoggerInterface em
GoogleAdsClientBuilder:
$googleAdsClient = (new GoogleAdsClientBuilder()) ... ->withLogger(new MyCustomLogger()) ->build();
[null,null,["Última atualização 2025-08-27 UTC."],[[["\u003cp\u003eThe PHP client library uses PSR-3 for logging gRPC calls, with log levels varying based on success or failure of the event.\u003c/p\u003e\n"],["\u003cp\u003eBy default, logs are written to \u003ccode\u003eSTDERR\u003c/code\u003e using a Monolog StreamHandler with configurable options in the \u003ccode\u003egoogle_ads_php.ini\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eFor advanced customization, developers can implement the \u003ccode\u003eLoggerInterface\u003c/code\u003e and provide their own logger to the \u003ccode\u003eGoogleAdsClientBuilder\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eLogging is currently not supported for REST calls.\u003c/p\u003e\n"]]],[],null,["# Logging\n\n| **Note:** Logging is not supported for REST calls yet.\n\nThe PHP client library conforms to [PSR-3](http://www.php-fig.org/psr/psr-3) for\nlogging and provides a logger for gRPC calls.\n\nThe [level](//www.php-fig.org/psr/psr-3/#5-psrlogloglevel) at which messages are\nlogged depends on whether the event succeeded.\n\n| Log message | Success status | Failure status |\n|------------------------------------|----------------|----------------|\n| One-line summary | INFO | WARNING |\n| Debug message (e.g., call queries) | DEBUG | NOTICE |\n\n#### Configuring logging\n\nBy default, each of the library loggers logs to\n[`STDERR`](http://php.net/manual/en/features.commandline.io-streams.php) on a\nchannel with default name specified\n[here](https://github.com/googleads/google-ads-php/blob/HEAD/src/Google/Ads/GoogleAds/Lib/V21/GoogleAdsClientBuilder.php#L34)\nusing a [Monolog\nStreamHandler](https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/StreamHandler.php).\n\nYou can configure some options for the default logger in the\n[`google_ads_php.ini`](https://github.com/googleads/google-ads-php/blob/HEAD/examples/Authentication/google_ads_php.ini)\nfile:\n\n\\[LOGGING\\] ; Optional logging settings. logFilePath = \"path/to/your/file.log\"\nlogLevel = \"INFO\"\n\nIf you need to further customize logging, you can specify your own logger\nentirely by providing a logger that implements the\n[`LoggerInterface`](//www.php-fig.org/psr/psr-3/) in\n[`GoogleAdsClientBuilder`](https://github.com/googleads/google-ads-php/blob/HEAD/src/Google/Ads/GoogleAds/Lib/V%0A21/GoogleAdsClientBuilder.php): \n\n $googleAdsClient = (new GoogleAdsClientBuilder())\n ...\n -\u003ewithLogger(new MyCustomLogger())\n -\u003ebuild();"]]