【问题标题】:Google Error Reporting not detecting errors logged by php applicationGoogle 错误报告未检测到 php 应用程序记录的错误
【发布时间】:2016-04-22 21:13:42
【问题描述】:

我无法让Error Reporting 处理我在 GCE 实例中运行的 php 应用程序报告的错误。

我已按照documentation 为我的 GCE 实例设置 Google 错误报告。

我已确认消息正在使用required format 记录到日志页面。

这是 GCP 的 Logging 部分中显示的错误之一

{
    metadata: {
        severity: "ERROR",
        projectId: <project_id>,
        serviceName: "compute.googleapis.com",
        zone: "us-central1-b",
        labels: {
            compute.googleapis.com/resource_name: <resource_name>,
            compute.googleapis.com/resource_type: "instance",
            compute.googleapis.com/resource_id: <resource_id>
        },
        timestamp: "2016-04-22T20:20:44.000Z",
        projectNumber: <project_number>,
    },
    insertId: <instert_id>,
    log: "alberta.errors",
    structPayload: {
        context: {
            reportLocation: {
                filePath: <path>,
                lineNumber: 22,
            }
        },
        serviceContext: {
            service: "alberta"
        },
        message: "SQLSTATE[08006] [7] FATAL:  password authentication failed ..."
    }
}

错误报告页面保持在设置状态:

我不知道从哪里开始,因为我已经用尽了可用的文档,也找不到遇到类似问题的人。

任何建议将不胜感激。

【问题讨论】:

    标签: php google-compute-engine google-cloud-platform


    【解决方案1】:

    我们的文档似乎不完整,对此深表歉意!如果“message”字段中没有包含堆栈跟踪,我们确实需要设置“functionName”。我们要么更新我们的文档,要么放宽这个要求。要显示您的错误,请暂时在“reportLocation”下添加“functionName”属性。

    顺便说一句,要快速检查给定的 JSON 是否会按预期显示在错误报告中,您可以使用 gcloud 命令如下(确保复制完整的 JSON 字符串):

    gcloud beta logging write --payload-type=struct alberta.errors \
     '{"serviceContext": {"service": "alberta"},"message": "SQLSTATE[08006] [7] FATAL:  password authentication failed ...","context": {"reportLocation": {"filePath": "/some/path/to/a/file.txt", "lineNumber": 42, "functionName": "someFunction"}}}'
    

    【讨论】:

      猜你喜欢
      • 2017-09-13
      • 2022-08-14
      • 2018-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-23
      • 2011-04-03
      相关资源
      最近更新 更多