我试图在我的服务器上安装的 influxdb 中记录我的本机角度应用程序日志。将日志发布到服务器 API 成功并返回 204 状态代码以及错误。为此,我参考了许多这样的答案,但对我不起作用。
错误:
{
JS: "headers": {
JS: "normalizedNames": {},
JS: "lazyUpdate": null,
JS: "headers": {}
JS: },
JS: "status": 204,
JS: "statusText": "Unknown Error",
JS: "url": null,
JS: "ok": false,
JS: "name": "HttpErrorResponse",
JS: "message": "Http failure during parsing for (unknown url)",
JS: "error": {}
JS: }
API调用:
const req = `spl.hpft AppComponent="testing",Message=" ${error.message ? error.message : null}",Error="${error.toString()}"`;
const headers = new HttpHeaders().set('Content-Transfer-Encoding', 'binary');
console.log('influxdb request sent');
this.httpClient.post(InfluxDb_Log, req, {headers:headers,responseType:'text' }).subscribe(payloadResponse => {
console.log('payloadResponse', payloadResponse);
console.log('influxdb response received', payloadResponse);
}, error => {
console.log('influx error', error);
});