viewing google app engine Python logging messages in CodeEnvy

111 Views Asked by At

I'm trying to move my GAE development to the cloud. So far Codeenvy has the richest toolset however I'm struggling with one small issue. when I use the python logging library I don't know where to view these messages!

def post(self):
    self.response.write('Processing form data...')
    feedback = self.request.get('content')
    logging.info(feedback)

I assumed they would appear in the console window however they are not output there. It seems strange given the huge support Codeenvy has for GAE that this appears not to be supported.

1

There are 1 best solutions below

0
On BEST ANSWER

When you use the logging library, the messages should be shown in Codenvy's console out of the box.

To also see your custom logs in the Google Developers Console,

You might have to supply logging.getLogger().setLevel(logging.DEBUG)

import logging
logging.getLogger().setLevel(logging.DEBUG)
...
...
def get(self):
    logging.info('Starting feedback...')
    self.response.write('Processing form data...')
    feedback = self.request.get('content')
    logging.info(feedback)

When I tried that in Codenvy, I got the following response

[STDOUT] INFO     2015-06-15 01:05:19,235 guestbook.py:62] Starting feedback...
[STDOUT] INFO     2015-06-15 01:05:19,236 guestbook.py:65] 
[STDOUT] INFO     2015-06-15 01:05:19,239 module.py:666] default: "GET /test HTTP/1.1" 200 23

To now view the logs in the Google Developers Console see the following,

The Logs Viewer provides a web-based UI to navigate, display, and search your logs. With the Logs Viewer you can view and search logs from all your instances and apply filters to narrow in on a specific event, regardless of where it was generated.

To access the Logs Viewer:

  1. Open your project in the Developers Console.
  2. Click Monitoring > Logs.
  3. Ensure App Engine is selected in the dropdown menu.