简体   繁体   中英

Stackdriver logging from node with stdout/stderr

On Google Cloud, when using a GAE or a cloud function in nodejs, we can log to stackdriver directly via stdout, as they explain here as follows:

Note: Logs written to stdout and stderr are automatically sent to Stackdriver Logging for you, without needing to use the Stackdriver Logging libraries for Node.js.

Is it possible to add structure to these logs? Like jsonPayload ? I would love to avoid client libraries, if possible.

App Engine and Cloud Functions both listen to std and can directly log to Stackdriver. The recommended approach for further customization is to directly use the client library instead of logging to std. For now, you can add structure to your Stackdriver logging using the jsonPayload field but the call will still need to go through the client libraries. Please check the following article for reference. I have already created a feature request for you on Google Issue Tracker so that it might help you get the feature that you have requested.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM