在本集中,我們會將部分自訂資料記錄至 Google Cloud Logging,我們會逐步引導您使用 Python 自訂範例,透過自訂 gRPC 攔截器將要求和回應資料,以及成功狀態和經過時間等中繼資料擷取到自訂記錄中。然後使用 Google Cloud Logging API 將這些記錄檔傳送至雲端。
將用戶端記錄傳送至 Google Cloud
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-21 (世界標準時間)。
[null,null,["上次更新時間:2025-08-21 (世界標準時間)。"],[[["\u003cp\u003eThis episode demonstrates how to log custom data to Google Cloud Logging using Python.\u003c/p\u003e\n"],["\u003cp\u003eThe example uses a gRPC interceptor to capture request/response data, success status, and elapsed time for logging.\u003c/p\u003e\n"],["\u003cp\u003eCustom logs are generated and sent to Google Cloud using the Google Cloud Logging API.\u003c/p\u003e\n"]]],[],null,["# Sending Client Logs to Google Cloud\n\nIn this episode, we log some custom data to Google Cloud Logging. We walk through a Python example which uses a custom gRPC interceptor to extract request and response data, as well as some metadata like success status and elapsed time, into custom logs. We then send those logs to the cloud using the Google Cloud Logging API.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e"]]