在文档中它说
注意:写入 stderr 的错误日志由错误报告自动处理,无需直接使用 Node.js 的错误报告库。
因此,我的应用程序(Node.js 14,App Engine 标准环境)将错误记录到stderr
并且我可以在 Google Cloud Logging 仪表板中看到它们。
// Error Object
{
"insertId": "60b9efa000007121b8631531",
"jsonPayload": {
"type": "Error",
"pid": 10,
"level": 50,
"stack": "Error: test\n at Object.<anonymous> (/workspace/dist/utils/logger.js:39:22)\n at Module._compile (internal/modules/cjs/loader.js:1068:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)\n at Module.load (internal/modules/cjs/loader.js:933:32)\n at Function.Module._load (internal/modules/cjs/loader.js:774:14)\n at Module.require (internal/modules/cjs/loader.js:957:19)\n at require (internal/modules/cjs/helpers.js:88:18)\n at Object.<anonymous> (/workspace/dist/routes/product-category/edit.js:8:18)\n at Module._compile (internal/modules/cjs/loader.js:1068:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)",
"message": "o noo",
"time": 1622798240028,
"hostname": "localhost"
},
"resource": {
"type": "gae_app",
"labels": {
"project_id": "xxx",
"zone": "us17",
"module_id": "default",
"version_id": "20210604t091336"
}
},
"timestamp": "2021-06-04T09:17:20.028961Z",
"severity": "ERROR",
"labels": {
"clone_id": "00c61b117c4c0ddc91320383c7a1462a90cff4d4f94ba3ec8a2e77217475dd58d4a633941d95a17ff0c2889faffc45f43561f51fad7d5a16bd1e38a1fba05e65fc70fdd43ec7"
},
"logName": "projects/xxx/logs/stderr",
"receiveTimestamp": "2021-06-04T09:17:20.046939477Z"
}
但这并没有在Google Cloud 错误报告仪表板(仪表板)中报告。
我认为stderr
错误报告器会自动使用 App Engine。