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

Clear (my) confusion: cf-nodejs-logging-support vs @sap/logging #93

Open piejanssens opened 3 years ago

piejanssens commented 3 years ago

What is the actual difference between these packages and the proper use-case for each?

I have used @sap/logging and actually ended up in this repo per accident looking for specific documentation on logging REMOTE_USER.

piejanssens commented 3 years ago

It seems for CAP applications, none of these are used (looking at the dependency tree), het logging to the CF Logging service works: https://cap.cloud.sap/docs/node.js/cds-log#cds-logger

juergen-walter commented 3 years ago

The cf-nodejs-logging-support library targets the Application Logging service for Cloud Foundry applications.

Afaik there is no good integration between CAP and this library but @KarstenSchnitter @nicklas-dohrn can probably add more beef to my statement.

piejanssens commented 3 years ago

FYI In the meanwhile I have raised the question regarding the REMOTE_USER in CAP here: https://answers.sap.com/questions/13497765/3-different-packages-provided-by-sap-for-logging-i.html

I don't see any added value of having @sap/logging around if cf-nodejs-logging-support is the pkg to target Application Logging service. Why would someone still want to use @sap/logging?

It would be good to avoid confusion if @sap/logging was deprecated and cf-nodejs-logging-support got a better name such as @sap/application-logging.

It would benefit everyone if sap-cloud-sdk and @sap/cds actually used this package instead of each having their own take on implementing an integration with the Application Logging service.

juergen-walter commented 3 years ago

We get your issue, it is not nice from a CAP customer side.

The Application Logging service documentation points to the correct libraries https://help.sap.com/viewer/ee8e8a203e024bbb8c8c2d03fce527dc/Cloud/en-US/d39c8a44992c4dbd86667b03ca5ab69a.html

We cannot say much about @sap/logging yet, we try to figure out. I think the pointers should be fixed on CAP side.

gregorwolf commented 2 years ago

Hi @juergen-walter,

this issue is open now for about 10 month. Is the clarification still ongoing or what is the result? Heve you taled to the CAP colleagues?

juergen-walter commented 2 years ago

There are two not 100% compatible use cases: Using CAP and Application Logging. Therefore, there are two libraries arround.

https://www.npmjs.com/package/@sap/logging "A package that provides logging and tracing functionalities for Node.js applications." --> It is included in SAP Cloud Application Programming Model (CAP)

https://www.npmjs.com/package/cf-nodejs-logging-support "provides a bundle of targeted logging services for node.js applications running on Cloud Foundry" --> Targets SAP Application Logging service for SAP BTP(would work for any other Elasticsearch or OpenSearch based service)

The libraries cannot be compatible as long as the services are not compatible.

gregorwolf commented 2 years ago

Hello @juergen-walter,

as far as I can see from sap/cds@6.1.0/package.json CAP has no dependency to @sap/logging. Based on the documentation CAP Service SDK for Node.js -> Minimalistic Logging Facade the logging functionality is provided by CAP itself. With Kibana-Friendly Formatter it seems also to provide the needed data for the SAP Application Logging -> Fields. Maybe @danjoa can add his insights here.

Best Regards Gregor