AI-generated Key Takeaways
-
This guide explains how to enable error logging for your Google Chat app, allowing you to view and analyze errors in Google Cloud Logs Explorer.
-
To enable error logging, you need a Google Workspace account, a Chat app, and the Cloud Logging API enabled in your Google Cloud project.
-
When enabled, Chat app errors are logged to Cloud Logging, which may incur costs; you can disable logging after troubleshooting.
-
You can turn off error logging to avoid incurring costs from Cloud Logging, but you can still query past logs.
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.
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.
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.
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.
Under Functionality, select Log errors to Cloud Logging.
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.
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.
Under Functionality, deselect Log errors to Cloud Logging.
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.
Related topics
After turning on error logging, you're ready to query error logs for your Chat app.