Am doing development on google app engine and i want to print out values that are sent to the server from the browser. When i insert the print commands in my handlers nothing get printed on the console running the local server!
How do i get around this?
Gath
Rather than just print
ing out values, use the logging module. This is generally good practice anyway as it means you can potentially leave in some handy debug output even when you are running in production mode.
import logging
logging.error("This is an error message that will show in the console")
By default dev_appserver.py will not show any messages below logging-level INFO, but you can run dev_appserver.py with the --debug
flag and then you will be able to see output from the lower logging.DEBUG
level and scatter various logging calls in your code like:
logging.debug("some helpful debug info")
If you leave these in once your app is in production, then these will be visible in your app's admin area in the logs section.
As @Chris Farmiloe suggested you should use the logging module . Google appengine by default supports logging modlue. You can see various levels of logs for your applications in appengine console. Logging module comes in handy in the production enviroment. Where you can see all your logs. For general info use
logging.info('This is just for information')
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