Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Control which logs are emitted to Log Center #2146

Open
johnboxall opened this issue Nov 26, 2024 · 0 comments
Open

[FEATURE] Control which logs are emitted to Log Center #2146

johnboxall opened this issue Nov 26, 2024 · 0 comments

Comments

@johnboxall
Copy link
Collaborator

johnboxall commented Nov 26, 2024

Managed Runtime environments can be configured to send logs to B2C Log Center:

https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/debugging.html#debug-using-log-center

Log Center has a quota on the # of messages that can be emitted per day.

Out of the box, PWA Kit logs at least one line for every HTTP request/response including its path, response status code and timing.

At scale, these this logging exhausts the Log Center quota.

It would be great if the PWA Kit (or alternatively MRT) had the ability to control which logs would be emitted to Log Center.

This might be an environment variables in the PWA Kit eg. PWA_KIT_LOG_LEVEL=error where on logs at or above the set level are logged. Alternatively, this might be a distinct configuration option on a Managed Runtime environment.

If you wanted to change the behaviour of the PWA Kit access logs today you would need to:

  1. Subclass RemoteServerFactory providing an implementation of _setupLogging. You could choose to drop all access logs or alternative only log request/responses with the specific status codes you're interested in.
  2. Implement a version of getRuntime using your subclass from above.
  3. Call your implementation of getRuntime in ssr.js.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant