Brian M. Hunt
Brian M. Hunt

Reputation: 83768

Capture google app engine logging output

How can one view the Google App Engine logs outside the Admin console?

I'm developing, so using dev_appserver.py/the Admin Console and would like to see the logs as the records are emitted.

I'd like to monitor the logging output in a console with standard Unix tools e.g. less/grep/etc, but there doesn't seem to be an option to direct the logging from the dev_appserver.py command, and I can't open a new file in GAE (e.g. a FileHandler), so file handlers won't work, and I think using a socket/udp handler would be a bit of overkill (if it's even possible).

I'm hopeful there are other options to view the log.

Thanks for reading.

Upvotes: 3

Views: 1217

Answers (2)

Wooble
Wooble

Reputation: 89847

The default logger sends logging output to stderr. Use your shell's method of redirecting stderr to a file (in tcsh, (dev_appserver.py > /dev/tty) >& your_logfile.txt, your shell may vary.)

You can also use the logging module in python to change the logger to send directly to a file if you detect it's running locally (os.environ['SERVER_SOFTWARE'].startswith('Dev'))

Upvotes: 5

Calvin
Calvin

Reputation: 4195

You can download the logs using the request_logs parameter of appcfg.py

http://code.google.com/appengine/docs/python/tools/uploadinganapp.html#Downloading_Logs

Edit: This person came up with a way to send logs over XMPP. His solution is for GAE Java, but this could be adapted to python.

http://www.professionalintellectualdevelopment.com/

http://code.google.com/p/gae-xmpp-logger/

Upvotes: 2

Related Questions