Query error logs for Google Workspace Add-ons

When a published Google Workspace Add-on returns an error, the add-on interface returns a generic message of "Something went wrong when executing the add-on." However, these errors get logged to to Google Cloud Logs Explorer.

This guide describes how to query add-on error logs in Google Cloud Logs Explorer, so you can:

  • Learn if users encounter errors.
  • See how often errors occur, and which are most frequent.
  • Read descriptive error messages that help you fix them.

Prerequisites

Before querying add-on error logs:

  • Enable the "Cloud Logging API" in the add-on's Google Cloud project. To enable an API, refer to Create a project and enable the API.
  • Publish the add-on on Google Workspace Marketplace. To publish an add-on on the marketplace, refer to Publish an app.

Query add-on error logs

To get logs for an add-on:

  1. Open the Google Cloud Console.
  2. Next to "Google Cloud Platform," click the Down arrow and select the add-on project.
  3. In the top-left corner, click Menu > Logging. The Logs Explorer opens.
  4. For add-ons error logs, in the query builder, enter the following query:

    severity>=ERROR
    protoPayload.serviceName="gsuiteaddons.googleapis.com"
    
  5. To see recent errors, click Run query. Or, to see errors as they occur, click Stream logs. Add-ons error logs appear in the "Query results" pane.

For further information on Google Cloud Logs Explorer and writing queries, refer to the following:

Enable or disable error logging

By default, error logging is enabled. If you want to disable error logging, add the following line to your add-on's manifest file:

// Disable error logging
"exceptionLogging": "NONE"

To re-enable error logging, remove the exceptionLogging line from the add-on's manifest file.

Considerations

As you work with add-ons error logs in Google Cloud Logs Explorer, take note of these considerations:

  • Add-ons only logs errors in Logs Explorer. Other log types are not recorded.
  • Error messages are always written in English.
  • Cloud Logging incurs a cost. For further information on Cloud Logging pricing, refer to Google Cloud's operations suite pricing.