查看Google Cloud Scheduler日志上的响应正文

时间:2019-07-18 16:47:35

标签: google-cloud-platform google-cloud-functions google-cloud-logging google-cloud-scheduler

This article说,只需单击“日志”列下的“查看”即可查看Google Cloud Scheduler日志的输出。但是,虽然我可以看到HTTP调度功能的状态代码,但看不到响应。例如,此请求通常返回一个对象数组,但这是我从Cloud Scheduler中获得的完整日志:

{
 httpRequest: {
  status:  200   
 }
 insertId:  "------"  
 jsonPayload: {
  @type:  "type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished"   
  jobName:  "projects/----/locations/us-west2/jobs/name"   
  targetType:  "HTTP"   
  url:  "http://endpoint.com/test"   
 }
 logName:  "projects/----/logs/cloudscheduler.googleapis.com%2Fexecutions"  
 receiveTimestamp:  "2019-07-18T16:00:12.574419040Z"  
 resource: {
  labels: {
   job_id:  "Name"    
   location:  "us-west2"    
   project_id:  "----"    
  }
  type:  "cloud_scheduler_job"   
 }
 severity:  "INFO"  
 timestamp:  "2019-07-18T16:00:12.574419040Z"  
}

我还如何查看Cloud Scheduler请求中的响应对象/文本?

1 个答案:

答案 0 :(得分:0)

  

我还如何从Cloud Scheduler查看响应对象/文本   请求?

Stackdriver不会记录HTTP响应正文。

您将需要将函数发送的HTTP响应登录到Stackdriver。这意味着在功能代码中增加了Stackdriver功能。

此链接包括Stackdriver示例:

Logging Client Libraries