Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

logging with Batch

I have a containerized Python application that I run with Batch. I use Python's Logger following the documentation at https://cloud.google.com/logging/docs/setup/python

If I run my image locally, I am able to see the logs in the general Cloud Logger. However, when submit the batch job, I get the error: 

"Waiting up to 5 seconds.
Program shutting down, attempting to send 14 queued log entries to Cloud Logging...

Sent all pending logs."

But I don't see any logs on the console.

If I don't use logger, but simply "print", I do see my logs, but with these two errors in the end:

"Waiting up to 5 seconds.
Sent all pending logs."

Ideally, I would like to use lLogger. Does anybody have any clue on this behavior? Thanks

 

 

 

0 1 851
1 REPLY 1

Hi @romanodev,

Welcome to the Google Cloud Community!

You can try the following troubleshooting options:

  1. Read more about this documentation that talks about No logs in Cloud Logging. A job needs to have Cloud Logging enabled so that it can produce logs in Cloud Logging. The job's runnables should be configured to write information you want to appear in the logs through standard output (stdout) and standard error (stderr) streams. 
  2. A task needs to have resources assigned and started running before logs can be produced. To resolve this issue, you can read more about it in this documentation.
  3. You can also get in touch with Google Cloud Support if the above options don't work.

Let me know if it helped, thanks!