views:

27

answers:

1

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")
+1  A: 

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.

David Underhill
Right, I meant that `logging.error()` wouldn't raise an exception as in a "this doesn't work on the devserver" exception.I see the "logging" button in the devserver GUI window. Cool. How do I change which level of message is printed?
Rosarch
You can control what level of messages are printed using [`logging.setLevel()`](http://docs.python.org/library/logging.html#logging.Logger.setLevel).
David Underhill
Hmm.. Any hint about when the logging service starts? In main.py, logging statements don't make it yet.
Charles Merriam