Google 错误报告未检测到 php 应用程序记录的错误

Google Error Reporting not detecting errors logged by php application

我在让 Error Reporting 处理我的 php 应用程序 运行 在 GCE 实例中报告的错误时遇到问题。

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

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

这是 GCP 的日志记录部分中出现的错误之一

{
    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 ..."
    }
}

错误报告页面仍处于设置状态:

我不确定从这里该何去何从,因为我已经用尽了可用的文档并且无法找到有类似问题的人。

如有任何建议,我们将不胜感激。

我们的文档似乎不完整,对此深表歉意!如果 "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"}}}'