HeronAlgoSearch
HeronAlgoSearch

Reputation: 1877

Print statements on python3 no longer logging on Google Cloud Platform

I am using python 3.5 and until a bit ago all print() statement in python3 logged to the logs viewer https://console.cloud.google.com/logs just fine. However, it suddenly stopped. Does anyone have a quick fix? Also, I did research and I found https://cloud.google.com/logging/docs/reference/libraries#client-libraries-install-python . It seems odd that I never had to do that before. Is that needed? Is that the 'right' way to do things? I am running in Kubernetes, and already have PYTHONUNBUFFERED set to '0', etc.

Any help would be deeply appreciated!

Upvotes: 2

Views: 1143

Answers (1)

HeronAlgoSearch
HeronAlgoSearch

Reputation: 1877

Found the root cause. Once you upgrade to 1.15 per https://cloud.google.com/monitoring/kubernetes-engine/migration the legacy logging that I was using will no longer work. You need to update the cluster with 'Kubernetes Engine Monitoring'. Further per https://cloud.google.com/monitoring/kubernetes-engine/migration (see the very bottom of that) we have "Since these types have changed in Kubernetes Engine Monitoring, be sure to look for your logs in the new resource types like Kubernetes Container, not in the Legacy Logging and Monitoring types such as GKE Container." That means the logs did not stop, they change location. In the logs viewer use 'Kubernetes Container' not 'GKE Container' and you should be good.

Upvotes: 3

Related Questions