ثبت خطا برای برنامههای گپ Google را روشن کنید
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این صفحه نحوه روشن کردن گزارش خطای برنامه Chat را توضیح میدهد تا بتوانید در حین آزمایش برنامه چت، گزارشهای خطا را در Google Cloud Logs Explorer جستجو کرده و مشاهده کنید.
پیش نیازها
برای روشن کردن گزارش خطای برنامه Chat، باید:
- یک حساب Google Workspace با دسترسی به Google Chat.
- یک برنامه چت برای ایجاد یک برنامه چت، این شروع سریع را دنبال کنید.
محیط را تنظیم کنید
قبل از جستوجو در گزارشهای خطای برنامه چت، باید Cloud Logging API را در پروژه Google Cloud برنامه Chat فعال کنید.
در کنسول Google Cloud، Cloud Logging API را روشن کنید. menu > APIs & Services > Library کلیک کنید. > Cloud Logging API را جستجو کنید > Cloud Logging API > Enable را کلیک کنید.
API را فعال کنید
ثبت خطا را روشن کنید
ثبت خطا را روشن کنید و زمانی که یک برنامه چت خطایی را برمیگرداند، آن را به گزارشگیری ابری ثبت میکند. از آنجایی که Cloud Logging هزینه دارد ، ممکن است بخواهید پس از اتمام عیبیابی، ثبت خطا را غیرفعال کنید .
در کنسول Google Cloud، به صفحه پیکربندی Chat API بروید. menu > محصولات بیشتر > Google Workspace > کتابخانه محصول > Google Chat API > مدیریت > پیکربندی کلیک کنید.
به Chat API بروید
در بخش Functionality، Log errors to Cloud Logging را انتخاب کنید.
روی ذخیره کلیک کنید.
اکنون، هر زمان که برنامه چت خطایی را برمیگرداند، خطا در Cloud Logging ثبت میشود.
ثبت خطا را خاموش کنید
از آنجایی که Cloud Logging هزینه دارد ، ممکن است بخواهید ثبت خطا را غیرفعال کنید.
در کنسول Google Cloud، به صفحه پیکربندی Chat API بروید. menu > محصولات بیشتر > Google Workspace > کتابخانه محصول > Google Chat API > مدیریت > پیکربندی کلیک کنید.
به Chat API بروید
در بخش Functionality، Log errors را به Cloud Logging بردارید.
روی ذخیره کلیک کنید.
اکنون، هر زمان که برنامه چت خطایی را برمیگرداند، خطا در Cloud Logging ثبت نمیشود. می توانید با استفاده از Logs Explorer به پرس و جوی گزارش های خطای گذشته ادامه دهید.
پس از روشن کردن ثبت خطا، آماده پرس و جو کردن گزارش های خطا برای برنامه چت خود هستید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-04 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-04 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThis guide explains how to enable error logging for your Google Chat app, allowing you to view and analyze errors in Google Cloud Logs Explorer.\u003c/p\u003e\n"],["\u003cp\u003eTo enable error logging, you need a Google Workspace account, a Chat app, and the Cloud Logging API enabled in your Google Cloud project.\u003c/p\u003e\n"],["\u003cp\u003eWhen enabled, Chat app errors are logged to Cloud Logging, which may incur costs; you can disable logging after troubleshooting.\u003c/p\u003e\n"],["\u003cp\u003eYou can turn off error logging to avoid incurring costs from Cloud Logging, but you can still query past logs.\u003c/p\u003e\n"]]],["To enable Chat app error logging, first enable the Cloud Logging API in the Google Cloud console. Then, navigate to the Chat API configuration page and under Functionality, select \"Log errors to Cloud Logging,\" and save. Errors are now logged to Cloud Logging. To disable, deselect \"Log errors to Cloud Logging\" and save. Remember to disable it when troubleshooting is complete, as Cloud Logging incurs a cost. Error logs can be viewed in Google Cloud Logs Explorer.\n"],null,["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](https://cloud.google.com/logging/docs/view/logs-viewer-interface) while testing your Chat app.\n\nPrerequisites\n\nTo turn on Chat app error logging, you need:\n\n- A Google Workspace account with access to Google Chat.\n- A Chat app. To build a Chat app, follow this [quickstart](/workspace/chat/quickstart/gcf-app).\n\nSet up the environment\n\nBefore querying Chat app error logs, you must enable the Cloud Logging API in the Chat app's Google Cloud project.\n\n1. In the Google Cloud console, turn on the Cloud Logging API. Click **Menu**\n menu\n \\\u003e **APIs \\& Services**\n \\\u003e **Library** .\n \\\u003e search for **Cloud Logging API**\n \\\u003e click **Cloud Logging API**\n \\\u003e **Enable**.\n\n [Enable the API](https://console.cloud.google.com/marketplace/product/google/logging.googleapis.com)\n\nTurn on error logging\n\nTurn on error logging and when a Chat app returns an error, it logs it to Cloud logging. Because Cloud Logging [incurs a cost](https://cloud.google.com/stackdriver/pricing), you might want to [turn off error logging](#turn-off-error-logging) after you finish troubleshooting.\n\n1. In the Google Cloud console, go to the Chat API **configuration** page. Click **Menu**\n menu\n \\\u003e **More products**\n \\\u003e **Google Workspace**\n \\\u003e **Product Library**\n \\\u003e **Google Chat API**\n \\\u003e **Manage**\n \\\u003e **Configuration**.\n\n [Go to Chat API](https://console.cloud.google.com/apis/api/chat.googleapis.com/hangouts-chat)\n2. Under Functionality, select **Log errors to Cloud Logging**.\n\n3. Click **Save**.\n\nNow, whenever the Chat app returns an error, the error gets logged to Cloud Logging.\n\nTurn off error logging\n\nBecause Cloud Logging [incurs a cost](https://cloud.google.com/stackdriver/pricing), you might want to turn off error logging.\n\n1. In the Google Cloud console, go to the Chat API **configuration** page. Click **Menu**\n menu\n \\\u003e **More products**\n \\\u003e **Google Workspace**\n \\\u003e **Product Library**\n \\\u003e **Google Chat API**\n \\\u003e **Manage**\n \\\u003e **Configuration**.\n\n [Go to Chat API](https://console.cloud.google.com/apis/api/chat.googleapis.com/hangouts-chat)\n2. Under Functionality, deselect **Log errors to Cloud Logging**.\n\n3. Click **Save**.\n\nNow, 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.\n\nRelated topics\n\nAfter turning on error logging, you're ready to [query error logs](/workspace/chat/query-logs) for your Chat app."]]