SAP / cf-nodejs-logging-support

Node.js Logging Support for Cloud Foundry provides the creation of structured log messages and the collection of request metrics
https://sap.github.io/cf-nodejs-logging-support/
Apache License 2.0
43 stars 22 forks source link

Array with stacktrace is stringified and resulting JSON is incorrect #100

Closed richardscholten closed 2 years ago

richardscholten commented 2 years ago

According to the documentation there is a 'stacktrace' field that should contain an array of strings:

https://help.sap.com/viewer/ee8e8a203e024bbb8c8c2d03fce527dc/Cloud/en-US/48b726c3f7534285b05eb31b5b7dc14d.html

This works in Java. The logged JSON contains a 'stacktrace' field with an array of strings and it is ingested by Elastic and visible in Kibana (using SAP Application Logging Service).

However, the JS version always stringifies each value resulting in a stringified array. It is not ingested by Elastic and the document contains a tag 'err/sanitize/type_err/stacktrace'. I guess it means the stacktrace has the incorrect type.

IntelliJ screenshot:

image

Resulting JSON:

{
   ...
  "type": "log",
  "stacktrace": "[\"test1\",\"test2\"]"
}
juergen-walter commented 2 years ago

Hi @richardscholten, unlike https://github.com/SAP/cf-java-logging-support, this library does not support it yet. @christiand93 will work on providing a fix soon.

christiand93 commented 2 years ago

Hi @richardscholten,

101 adds this feature. Once it is merged, I will prepare a new release.

Kind regards, Christian

christiand93 commented 2 years ago

Hi @richardscholten, logging stack traces is now available (v6.12.0). The feature is documented here. Kind regards, Christian