A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/apps-script/guides/logging below:

Logging | Apps Script | Google for Developers

Logging

Stay organized with collections Save and categorize content based on your preferences.

When developing any kind of app, you often want to log information to help diagnose faults during development, to identify and diagnose customer issues, and for other purposes.

Apps Script provides three different mechanisms for logging:

These are described in the following sections. In addition to these mechanisms, you can also build your own logger code that, for example, writes information to a logging Spreadsheet or JDBC database.

Use the Apps Script execution log

A basic approach to logging in Apps Script is to use the built-in execution log. To view these logs, at the top of the editor, click Execution log. When you run a function or use the debugger, the logs stream in real time.

You can use either the Logger or console logging services in the built-in execution log.

These logs are intended for simple checks during development and debugging, and do not persist very long.

For example, consider this function:

When this script is run with inputs "2" and "john@example.com" the following logs are written:

[16-09-12 13:50:42:193 PDT] Emailing data row 2 to john@example.com
[16-09-12 13:50:42:271 PDT] Row 2 data: Cost 103.24

Cloud Logging

Apps Script also provides partial access to the Google Cloud Platform (GCP) Cloud Logging service. When you require logging that persists for several days, or need a more complex logging solution for a multi-user production environment, Cloud Logging is the preferred choice. See Cloud Logging quotas and limits for data retention and other quota details.

If you need more logging quota, you can submit a Google Cloud Platform quota request. This requires that you have access to the Cloud Platform project that your script uses.

Note: Cloud Logging provides a number of services beyond storing logs, such as alerts and metrics. At this time these services aren't available from Apps Script. Using Cloud Logging

Cloud logs are attached to the Google Cloud project associated with your Apps Script. You can view a simplified version of these logs in the Apps Script dashboard.

To make full use of Cloud Logging and its capabilities, use a standard Google Cloud project with your script project. This lets you access Cloud logs directly in the GCP Console and gives you more viewing and filtering options.

Note: If you use the Rhino runtime, Cloud Logging doesn't support the Apps Script Logger service. Instead, use the console service.

When logging, it is good privacy practice to avoid recording any personal information about the user, such as email addresses. Cloud logs are automatically labeled with active user keys you can use to locate a specific user's log messages when necessary.

You can log strings, formatted strings, and even JSON objects using the functions provided by the Apps Script console service.

The following example shows how to use the console service to log information in Cloud Operations.

Active user keys

Temporary active user keys provide a convenient way to spot unique users in Cloud Log entries without revealing the identities of those users. Keys are per script and change roughly once a month to provide additional security should a user reveal their identity to a developer, for example while reporting an issue.

Temporary active user keys are superior to logging identifiers like email addresses because:

To find temporary active user keys in your Cloud Log entries, view your Cloud logs in the Google Cloud console. You can do this only if your script project is using a standard Google Cloud project that you have access to. Once you've opened the Google Cloud project in the console, select a log entry of interest and expand it to view metadata > labels > script.googleapis.com/user_key.

You can also get the temporary active user key by calling Session.getTemporaryActiveUserKey() in your script. One way to use this method is to display the key to the user while they are running your script. Then users may choose to include their keys when reporting issues to help you identify the relevant logs.

Exception logging

Exception logging sends unhandled exceptions in your script project code to Cloud Logging, along with a stack trace.

To view exception logs, follow the steps below:

  1. Open the Apps Script project.
  2. At the left, click Executions playlist_play.
  3. At the top, click Add a filter > Status.
  4. Select the Failed and Timed out checkboxes.

You can also view logged exceptions in the GCP console if your script project is using a standard Google Cloud project that you have access to.

Enable exception logging

Exception logging is enabled by default for new projects. To enable exception logging for older projects, follow the steps below:

  1. Open the script project.
  2. At the left, click Project Settings settings.
  3. Select the Log uncaught exceptions to Cloud Operations checkbox.
Error Reporting

Exception logging automatically integrates with Cloud Error Reporting, a service that aggregates and displays errors produced in your script. You can view your Cloud error reports in the Google Cloud console. If you are prompted to "Set up Error Reporting" this is because your script has not yet logged any exceptions. No setup is required beyond enabling exception logging.

Logging requirements

There are no requirements for using the built-in execution log.

You can view a simplified version of Cloud logs in the Apps Script dashboard. However, to make the most of Cloud Logging and error reporting you must have access to the GCP project of the script. This is only possible if your script project is using a standard Google Cloud project.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-04 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-04 UTC."],[[["Apps Script provides three logging mechanisms: the built-in execution log, Cloud Logging, and Error Reporting to assist with debugging and monitoring."],["The execution log, accessed via the editor, streams real-time logs but with limited persistence, suitable for basic development checks."],["Cloud Logging offers persistent logs viewable in the Developer Console or Apps Script dashboard, ideal for multi-user environments and detailed analysis."],["Error Reporting automatically collects and displays script exceptions in the Developer Console or GCP console, streamlining error identification and resolution."],["Exception logging is enabled by default for new Apps Script projects, and requires a standard Google Cloud project for full functionality with Cloud Logging and Error Reporting."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4