Does logging work on the dev server? This code doesn't raise an exception, but I can't see where to view the logs in the devserver console. Perhaps I'm looking in the wrong place?
logging.error("error has occurred")
Logs in Google Cloud Platform for App Engine, and all other Google Cloud Platform resources can be viewed in Stackdriver Logging.
Make sure you create your logger. This should work.
Code
import logging
logging.getLogger().setLevel(logging.DEBUG)
logging.error("uuu")
logging.info("ggg")
Launching from the CLI
$dev_appserver.py ~/workspace/helloworld/
The logs I got on the CLI...
ERROR 2012-11-26 03:02:25,467 helloworld.py:89] uuu
INFO 2012-11-26 03:02:25,467 helloworld.py:90] ggg
Note that this also works for me in Tornado.
Yes, logging works on the dev server. When dev_appserver.py is run from the command-line, you should see output from logging calls such as the one you mentioned whenever they are called.
By default, only logging messages of INFO level and higher are printed.
Also, logging.error()
does not raise an exception when called. It simply logs the string you pass at the "error" level - on the development server, this basically just means it will print "ERROR" as part of the logging message on the development server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With