App Engine maintains a log of messages that your application emits using the
logging module from the Python standard library, as well as other messages printed to the standard error stream.
App Engine also records
each request in the log. Each log level has a fixed buffer size that controls the amount of log information you can access. Normally, you use logging features more at lower log levels; thus, the time window is smaller for log events at these levels. In the Cloud Platform Console, you can browse your app's logs of the last 90 days.
Requesting the logs
If you wish to perform more detailed analysis of your application's logs, you can download the log data to a file on your computer. To download logs to a file named
mylogs.txt, use the following command:
appcfg.sh request_logs myapp/ mylogs.txt
By default, the command downloads log messages from the current calendar day (since midnight Pacific Time) with a log level of INFO or higher (omitting DEBUG level messages). The command overwrites the local log file. You can adjust the number of days, the minimum log level, and whether to overwrite or append to the local log file using command-line options. See below for more information on these options.
You can limit the log messages that are downloaded to just those emitted during request on a given domain name using the
--vhost=... option. You can use this to download the logs for your live app using a Google Apps domain or
http://your_app_id.appspot.com, excluding log messages emitted by versions you are testing on URLs such as
http://2.latest.your_app_id.appspot.com. Or you can use it to download just the log messages for a given test domain.
There are many options for the
request_logs command. You can view them all by typing:
appcfg.sh help request_logs