Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
La libreria client PHP è conforme a PSR-3 per la registrazione e fornisce un logger per le chiamate gRPC.
Il livello a cui vengono registrati i messaggi dipende dall'esito dell'evento.
Messaggio di log
Stato di successo
Stato di errore
Riepilogo in una riga
INFORMAZIONI
AVVISO
Messaggio di debug (ad es. query di chiamata)
DEBUG
NOTA
Configurazione del logging
Per impostazione predefinita, ogni logger della libreria registra i dati in
STDERR su un
canale con il nome predefinito specificato
qui
utilizzando un Monolog
StreamHandler.
Puoi configurare alcune opzioni per il logger predefinito nel file
google_ads_php.ini:
Se devi personalizzare ulteriormente la registrazione, puoi specificare un logger personalizzato
fornendo un logger che implementi l'interfaccia
LoggerInterface in
GoogleAdsClientBuilder:
$googleAdsClient = (new GoogleAdsClientBuilder()) ... ->withLogger(new MyCustomLogger()) ->build();
[null,null,["Ultimo aggiornamento 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();"]]