Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I write to the console in Google App Engine?

Often when I am coding I just like to print little things (mostly the current value of variables) out to console. I don't see anything like this for Google App Engine, although I note that the Google App Engine Launcher does have a Log terminal. Is there any way to write to said Terminal, or to some other terminal, using Google App Engine?

like image 365
Stephen Cagle Avatar asked Apr 07 '09 20:04

Stephen Cagle


People also ask

How do I debug Google App Engine?

Select Run > Debug. In the dialog, click Google App Engine Standard Local Server. After the project builds, you can set breakpoints to debug your app.


1 Answers

You'll want to use the Python's standard logging module.

import logging  logging.info("hello") logging.debug("hi") # this won't show up by default 

To see calls to logging.debug() in the GoogleAppEngineLauncher Logs console, you have to first add the flag --dev_appserver_log_level=debug to your app. However, beware that you're going to see a lot of debug noise from the App Engine SDK itself. The full set of levels are:

  • debug
  • info
  • warning
  • error
  • critical

You can add the flag by double clicking the app and then dropping it into the Extra Flags field.

Adding the --dev_appserver_log_level flag to your app in the GoogleAppEngineLauncher

like image 159
Chris Calo Avatar answered Sep 21 '22 21:09

Chris Calo