If I am running a container within Cloud Run and do a print statement in my python code. Where can I view it? Cloud logs seem to show logs for the contain itself(build, etc)?
to debug my code often I do write statements that help me figure what's going on. Where would that print output be located?
1] You can find all the logs including your print statement output in Cloud Logging as mentioned in this link. So when you write a print statement from your service they will be automatically picked up by Cloud Logging.
2] Steps to view logs in Cloud Logging: Logs Explorer -> Cloud Run Revision.
3] You may wanna check your logging level. For example: if you have configured level as logging.ERROR in basicConfig (default is WARNING), and used logging.info() in your code, then it will not be printed. You can refer to this link for more information.
4] Also, you may try flushing the stdout which will make sure the logs get written from buffers. You may refer Stackoverflow answer on how to do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With