Andreas Neumeier
Andreas Neumeier

Reputation: 326

Write application logs in Google App Engine with Python3?

In an effort to trace problems, my Python application needs to write logfiles. The application is supposed to migrate from Python2 to Python3, that is also supported on GCP as of recently. Google offers documentation for how to write application logs here: https://cloud.google.com/appengine/articles/logging#standard_environment_logs

Summarizing the above documentation, the application is only supposed to write to stdout/stderr, which GAE would collect.

Until now, the previous application does not appear. Following the above documentation I tried writing to stdout.

def some_func():                                                               
  """                                                                          
  Write an application log  
  """                                                                          
  print("(empty payload)")                                                            
  return make_response("OK", 200)    

The expected result is I would find "(empty payload)" in the logfile.

However, I cannot find it. Am I missing something obvious?

Upvotes: 1

Views: 376

Answers (1)

Andreas Neumeier
Andreas Neumeier

Reputation: 326

Frankly, this was a stupid question. The content I tried to find in the log was base64 encoded, which was the reason I couldn't find it.

Upvotes: 1

Related Questions