Does Apigee log javascript print statements in GCP?

ven
Bronze 1
Bronze 1

Hi,

We use Apigee Hybrid as the gateway. We developed lot of re-usable features in the form of shared flows. Some of them include http calls through java script due to the nature of the requirement. Whenever we want to debug locally, using the Debug console in the edge UI, we use print statement and look at the logs in the debug console. However, when we want to troubleshoot any issues in the PROD environment, we cannot use debug console unless we can replicate the issue at will. Wondering if the print statements are logged to GCP console or if there is anyway to log it (one way is to write these to syslogs and use our own connector to log to aggregator). Other than this, is there any standard way where we can log print statements to gcp so that we can see it in gcp logs? I checked gcp logs and it is not logging the print statements out of the box.

0 1 342
1 REPLY 1

No, the JavaScript callout does not log to GCP Logging. The output of these print statements is available in the Debug console only. 

If you need on-demand production-level logging, you may consider implementing that JS callout as a standalone JS app.  Put it into CloudRun or similar.  (here is a tutorial on running a nodejs-bsed gRPC server in Cloud Run). You can then connect to that services from your API Proxy via the ExternalCallout policy.  Apigee will connect to your service using gRPC.  That standalone app can then call out to some other http service, and will have the ability to log anything you need to GCP logging.