app engine python setup
Question: << Big update below implies it's simply a logging issue >>

I'm trying to get app engine setup with python and having some problem that I
suspect is some simple step I've missed. My app.yaml says this:

    
    
    application: something  #name here is the one I used to register i.e. something.appspot.com
    version: 1
    runtime: python
    api_version: 1
    
    handlers:
    - url: .*
      script: myapp.py
    

and my myapp.py says this:

    
    
    import cgi
    import Utils
    import Sample
    import logging
    
    from google.appengine.api import users
    from google.appengine.ext import webapp
    from google.appengine.ext.webapp.util import run_wsgi_app
    from google.appengine.ext import db
    
    class MainPage(webapp.RequestHandler):
        def get(self):
            self.response.out.write('<html><body>')
            self.response.out.write('Welcome to my server! Why is this not working?')
            self.response.out.write('</body></html>')
    
    def main():
        application = webapp.WSGIApplication([('/', MainPage),
                                            ('/Sample', Sample.HttpRequestHandler)],
                                            debug=True)
    
        run_wsgi_app(application)
    
    if __name__ == "__main__":
        main()
    

When I run this on localhost, I get my html "Welcome" message when passing in
/ but when I pass in /Sample I don't get any where. Also, I can't seem to log
messages. I call logging.debug() and nothing shows on the log console. Any
ideas? Here is my Sample.py. Sorry about the strange tabbing. Copy paste
didn't line them up and editing it by hand didn't seem to correct it.

    
    
    class HttpRequestHandler(webapp.RequestHandler):
        def get(self):
    
            Utils.log("Sample handler called")
    
            try:
                if HttpRequestHandler.requestIsValid(self):
    
                intParam = int(self.request.get('param1'))
                floatParam = float(self.request.get('param1'))
                stringParam = self.request.get('param1')
    
                Utils.log("params: " + str(intParam) + " " + str(floatParam) + " " + stringParam)
    
                if intParam == 1:
                    self.response.set_status(200, message="Success")
                else:
                    self.response.set_status(400, message="Error processing sample command")
    
                else:
                raise StandardError
    
            except Exception, e:
                logging.debug("Exception: %s" % (e))
                self.response.set_status(400, message="Error processing sample command")
    
        def requestIsValid(self):
            if self.request.get('param1') != "" and \
            self.request.get('param2') != "" and \
            self.request.get('param3') != "":
                return True
            else:
                return False
    

So I know this is totally lame, but since I couldn't see any log messages, I
threw in a bunch of "raise StandardError" calls just to see what would throw
exception output to my browser window when I try to invoke my Sample message.
What I found was that the server is calling into the Sample handler just fine
it seems, even checking the int param is right.

I think the problem is that I just can't see my log messages! Any idea why
they aren't showing up? I call logging.debug() through those Util.log() calls.
Is there some flag or something suppressing my output from showing in the log
console?


Answer: You don't have `RequestHandler` subclass for the `"/Sample"` path, like you do
for the `"/"` path (i.e., `MainPage`).

To get logs, either start your SDK app server with `dev_appserver.py` and look
at the logs it spits out, or click the Logs button in the Google App Engine
Launcher GUI.

