在 Cloud Run 中設定

系統會自動為 Cloud Run 應用程式啟用 Error Reporting。對於大多數程式設計語言,寫入 stderrstdout 或其他記錄的例外狀況 (包含 Error Reporting 支援語言的堆疊追蹤),都會寫入 Cloud Logging,並由 Error Reporting 自動偵測。如果未偵測到例外狀況,建議您使用適用於您語言的 Error Reporting 用戶端程式庫。詳情請參閱「使用用戶端程式庫為應用程式加入檢測功能」。

如要瞭解如何手動回報錯誤事件,請參閱「在 Cloud Logging 中設定錯誤格式」。

查看錯誤

如要在 Cloud Run 中查看例外狀況記錄,請前往服務詳細資料頁面的「指標」分頁標籤。其中包含表格,顯示 Error Reporting 偵測及彙整的 Cloud Run 重大錯誤。

如需在 Google Cloud 控制台中查看應用程式的錯誤和例外狀況資料的操作說明,請參閱「查看錯誤」一文。