Logi wykonania
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Skrypty Google Ads wyświetlają 2 typy dzienników wykonania zarówno w trybie podglądu, jak i w przypadku rzeczywistych wykonań: dzienniki zmian i dane wyjściowe dzienników.
- Historia zmian
Dzienniki zmian wyświetlają wszystkie zmiany w elementach Google Ads wprowadzone przez skrypt: opis elementu, typ zmiany, wartość przed i po zmianie oraz błędy (jeśli występują):

Dzienniki zmian można dodatkowo filtrować, aby wyświetlać tylko błędy.
- Dane wyjściowe logów
Jeśli w skrypcie wykonasz console.log("Hello world!");
, w logach pojawi się „Hello
world!”. Rejestrowanie fragmentów tekstu jest szczególnie przydatne podczas debugowania, ale często pomaga też podczas wykonywania kodu na żywo.
Załóżmy, że ten skrypt jest zaplanowany do uruchamiania codziennie:
let spreadsheet = SpreadsheetApp.create("Daily Report");
// Populate the spreadsheet.
// ...
console.log("Daily report ready!");
console.log(spreadsheet.getUrl());
Przy każdym wykonaniu skrypt rejestruje adres URL nowo utworzonego arkusza kalkulacyjnego, co ułatwia jego późniejsze znalezienie. Możesz też użyć znaków console.warn()
lub console.error()
, aby rejestrować w logach tekst w kolorze pomarańczowym lub czerwonym.
Oprócz komunikatów dziennika określonych przez programistę w dziennikach tekstowych będą się też pojawiać wszelkie błędy i ostrzeżenia, które skrypty Google Ads napotkają podczas wykonywania.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-08-27 UTC.
[null,null,["Ostatnia aktualizacja: 2025-08-27 UTC."],[[["\u003cp\u003eGoogle Ads scripts provide two types of execution logs: Changes logs (tracking entity modifications) and Logs output (displaying script messages).\u003c/p\u003e\n"],["\u003cp\u003eChanges logs detail all alterations made by the script to Google Ads entities, including before and after values, and can be filtered to show only errors.\u003c/p\u003e\n"],["\u003cp\u003eLogs output displays messages generated by the script using \u003ccode\u003econsole.log\u003c/code\u003e, \u003ccode\u003econsole.warn\u003c/code\u003e, and \u003ccode\u003econsole.error\u003c/code\u003e, useful for debugging and providing context during live executions.\u003c/p\u003e\n"],["\u003cp\u003eErrors and warnings encountered by scripts during execution are automatically included in the text logs for troubleshooting.\u003c/p\u003e\n"]]],[],null,["# Execution Logs\n\nGoogle Ads scripts display two types of execution logs, both in preview mode and in\nreal executions: Changes logs and Logs output.\n\nChanges log\n\n: Changes logs display all changes to Google Ads entities performed by the\n script: entity description, type of change, value before and after, and errors\n (if any):\n\n:\n\n: Changes logs can be further filtered to only display errors.\n\nLogs output\n\n: If you execute `console.log(\"Hello world!\");` in a script, \"Hello\n world!\" appears in the logs. Logging bits of text is particularly useful\n during debugging, but is often helpful during live executions too.\n Suppose the following script is scheduled to run daily:\n\n let spreadsheet = SpreadsheetApp.create(\"Daily Report\");\n // Populate the spreadsheet.\n // ...\n console.log(\"Daily report ready!\");\n console.log(spreadsheet.getUrl());\n\n: In every execution, the script logs the URL of the newly created spreadsheet,\n making it easier to find later. You can also use `console.warn()` or\n `console.error()` for logging orange or red text in the logs.\n\nIn addition to programmer-specified log messages, any\n[errors and warnings](/google-ads/scripts/docs/concepts/errors) the Google Ads scripts\nencounters during execution will also appear in the text logs."]]