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

前端 未结 11 1638
终归单人心
终归单人心 2020-12-08 09:30

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, alth

相关标签:
11条回答
  • 2020-12-08 09:57

    Check out my online Python interpreter running on Google App Engine on my website, Learn Python. It might be what you're looking for. Just use print repr(variable) on things you want to look at, and execute as many times as you want.

    0 讨论(0)
  • 2020-12-08 10:00

    Hello I'm using the version 1.8.6 of GoogleAppEngineLauncher, you can use a flag to set the messages log level you want to see, for example for debug messages:

    --dev_appserver_log_level debug

    Use it instead of --debug (see @Christopher answer).

    0 讨论(0)
  • 2020-12-08 10:02

    See https://cloud.google.com/appengine/docs/python/requests#Python_Logging
    and http://docs.python.org/library/logging.html

    You probably want to use something like:

    logging.debug("value of my var is %s", str(var))
    
    0 讨论(0)
  • 2020-12-08 10:06

    Use log.setLevel(Level.ALL) to see messages

    The default message filtering level seems to be 'error'. I didn't see any useful log messages until I used the setLevel() method to make the .info and .warning messages visible.

    Text printed to System.out wasn't showing up either. It seems to be interpreted as log.info() level messaages.

    0 讨论(0)
  • 2020-12-08 10:07

    I hope i am answering the question. The logging messages print to the AppEngine log rather than the terminal.

    You can launch it by clicking on the logs button of the AppEngine Launcher

    0 讨论(0)
提交回复
热议问题