开发者社区> 问答> 正文

未检测到GCP错误报告stacktrace样本

我目前正在尝试为Symfony项目(PHP)实现GCP错误报告,以便报告任何错误,尤其是应用程序的堆栈跟踪。该实现是通过使用Google Cloud Client Library完成的。但是,看来GCP没有检测到我正在发送的stacktrace。以下是界面上的屏幕截图:如本文档中所述。我必须精确确定要发送给ReportedEventError的消息的类型(如果我没有记错的话,消息应该以'PHP Fatal Error'开头)字符串,以便将该消息识别为堆栈跟踪。但这没有用。

为了帮助您解决以下问题,以下是Google Cloud Client Library发送的JSON酬劳。

    "insertId": "INSERT ID ",
    "jsonPayload": {
      "context": {
        "httpRequest": {
          "responseStatusCode": 500,
          "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
          "method": "GET",
          "url": "/ping/edit",
          "remoteIp": "172.18.0.1"
        },
        "reportLocation": {
          "functionName": "editAction",
          "filePath": "/app/src/NS/PingBundle/Controller/DefaultController.php",
          "lineNumber": 24
        }
      },
      "message": "PHP Fatal error: #0 [internal function]: NS\\CommonBundle\\EventListener\\ExceptionListener->onKernelException(Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher))\n#1 /app/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php(104): call_user_func(Array, Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher))\n#2 [internal function]: Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener->__invoke(Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher))\n#3 /app/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(212): call_user_func(Object(Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener), Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher))\n#4 /app/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(44): Symfony\\Component\\EventDispatcher\\EventDispatcher->doDispatch(Array, 'kernel.exceptio...', Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent))\n#5 /app/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php(146): Symfony\\Component\\EventDispatcher\\EventDispatcher->dispatch('kernel.exceptio...', Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent))\n#6 /app/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(230): Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher->dispatch('kernel.exceptio...', Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseForExceptionEvent))\n#7 /app/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(79): Symfony\\Component\\HttpKernel\\HttpKernel->handleException(Object(Exception), Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#8 /app/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(171): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#9 /app/web/app_dev.php(28): Symfony\\Component\\HttpKernel\\Kernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#10 {main}",
      "serviceContext": {
        "service": "hummingbird-sf"
      },
      "@type": "type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent"
    },
    "httpRequest": {
      "requestMethod": "GET",
      "requestUrl": "/ping/edit",
      "status": 500,
      "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36",
      "remoteIp": "172.18.0.1"
    },
    "resource": {
      "type": "reported_errors",
      "labels": {
        "project_id": "<project_id>"
      }
    },
    "timestamp": "2019-12-09T14:33:51.792619820Z",
    "severity": "ERROR",
    "logName": "projects/<project_id>/logs/clouderrorreporting.googleapis.com%2Freported_errors",
    "sourceLocation": {
      "file": "/app/src/NS/PingBundle/Controller/DefaultController.php",
      "line": "24",
      "function": "editAction"
    },
    "receiveTimestamp": "2019-12-09T14:33:51.792619820Z"
  }

注意:我也尝试删除也不起作用的位置。至于Symfony框架集成,由于其他原因,该解决方案也不起作用。

有人有什么想法吗?

展开
收起
社区秘书 2019-12-10 11:50:09 691 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
140-弱监督机器学...1506573734.pdf 立即下载
内容安全检测与管控 立即下载
Android内存泄漏自动化链路分析组件--Probe 立即下载