X
Business

Google Cloud's Python logging library just got a 'major' update

Google's Python logging tool now supports Google Cloud serverless environments.
Written by Liam Tung, Contributing Writer

Google has released a "major update" to the Google Cloud Python logging library for monitoring and troubleshooting Python-based containerized apps in the cloud and its serverless environments. 

The new version of 'google-cloud-logging', v3.0 on GitHub, gives Python developers real-time insights into the performance of an application hosted on Google Cloud's compute infrastructure. The main update to the library is support for Python applications in its serverless environments. 

The new version of google-cloud-logging fixes an issue that dropped unsent log batches after developers deactivated apps in Google Cloud's serverless environments. These include Cloud Run, which is a managed service for containerized apps, and Cloud Functions, which is an alternative to Amazon Web Service's Lambda and Microsoft Azure Functions Serverless Compute.

SEE: Cloud computing: Spreading the risk with the multicloud approach

"Previous versions of google-cloud-logging supported only App Engine and Kubernetes Engine," Google explains in a blogpost

"Users reported that the library would occasionally drop logs on serverless environments like Cloud Run and Cloud Functions. This was because the library would send logs in batches over the network. When a serverless environment would spin down, unsent batches could be lost."

This version fixes the issue by using Google Cloud Platform's built-in "structured JSON logging functionality" in Google Kubernetes Engine, Cloud Run, and Cloud Functions. In these environments, it will automatically use the new StructuredLogHandler and write logs as JSON strings printed to standard out, according to Google. 

Parsed logs are then automatically handed to Cloud Logging, even when the code that produced the logs has spun down. 

Google's cloud-logging tool now automatically detects and attaches metadata about an environment to each log message to make troubleshooting an application easier. 

This version of cloud logging also brings support for logging JSON payloads for LogEntries in the standard Python logging library integration, rather than only logging string payloads as in previous versions. Google offers more details in the version 3.0 migration guide

The Python logging tool is part of Google's efforts to improve tooling capabilities to give developers visibility into their applications and run reliable production systems. 

Google Cloud is still making losses for the company, but its revenues are growing faster than AWS and Microsoft Azure. Google Cloud had a 9% share of the $53.5 billion organizations spent on cloud infrastructure services in Q4 2021, according to analyst Canalys. AWS had a 33% share, while Microsoft Azure took 22% of the pie.  

Editorial standards