Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find python print statements in Cloud Run docker instances?

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?

like image 914
Lostsoul Avatar asked Sep 13 '25 21:09

Lostsoul


1 Answers

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.

like image 77
Zeenath S N Avatar answered Sep 15 '25 11:09

Zeenath S N