Turn on error logging for Google Chat apps

This page describes how to turn on Chat app error logging, so that you can query and view error logs in Google Cloud Logs Explorer while testing your Chat app.

Prerequisites

To turn on Chat app error logging, you need:

  • A Google Workspace account with access to Google Chat.
  • A Chat app. To build a Chat app, follow this quickstart.

Set up the environment

Before querying Chat app error logs, you must enable the Cloud Logging API in the Chat app's Google Cloud project.

  1. In the Google Cloud console, turn on the Cloud Logging API. Click Menu > APIs & Services > Library. > search for Cloud Logging API > click Cloud Logging API > Enable.

    Enable the API

Turn on error logging

Turn on error logging and when a Chat app returns an error, it logs it to Cloud logging. Because Cloud Logging incurs a cost, you might want to turn off error logging after you finish troubleshooting.

  1. In the Google Cloud console, go to the Chat API configuration page. Click Menu > More products > Google Workspace > Product Library > Google Chat API > Manage > Configuration.

    Go to Chat API

  2. Under Functionality, select Log errors to Cloud Logging.

  3. Click Save.

Now, whenever the Chat app returns an error, the error gets logged to Cloud Logging.

Turn off error logging

Because Cloud Logging incurs a cost, you might want to turn off error logging.

  1. In the Google Cloud console, go to the Chat API configuration page. Click Menu > More products > Google Workspace > Product Library > Google Chat API > Manage > Configuration.

    Go to Chat API

  2. Under Functionality, deselect Log errors to Cloud Logging.

  3. Click Save.

Now, whenever the Chat app returns an error, the error doesn't get logged to Cloud Logging. You can continue to query past error logs using Logs Explorer.

After turning on error logging, you're ready to query error logs for your Chat app.