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")
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")
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.You can configure the default logging level when starting the development server:
From dev_appserver.py command-line arguments:
Make sure you create your logger. This should work.
Code
Launching from the CLI
The logs I got on the CLI...
Note that this also works for me in Tornado.