Tag Archives: appcfg

Downloading Google App Engine Logs

Facebooktwitterredditpinterestlinkedinmail

 

It looks like downloading the logs from an application deployed into GAE is straight forward and the documentation is here. Well for someone new to GAE this is not enough because running the example in the documentation:

./appengine-java-sdk/bin/appcfg.sh request_logs myapp/war mylogs.txt

Will result in the following error: Unable to find the webapp directory myapp/war, this is basically because you might be thinking that your app name/path is the id you given you app when it was deployed into GAE, in fact it’s not. What no one tells you is that this the path to the directory where your app is located on the local disk. Appcfg will then read your WEB-INF/appengine-web.xml file to figure out where to get the logs from.

So here is a full example on how to get the GAE logs for your app which is currently deployed into Google Apps Engine and its directory structure is available locally. First from the command line change into your GAE app folder, then assuming the bin folder of your GAE SDK is on the classpath run:

$ appcfg.sh -e your_email@example.com --num_days=3 --severity=0 request_logs myapp/war mylogs.txt

To get the log for a backend instance simply use  –version=backend-name, like this:

$ appcfg.sh -e your_email@example.com --num_days=3 --version=backend-name request_logs myapp/war mylogs.txt

Appcfg will prompt for the password and progress as follows:


Reading application configuration data…
Dec 19, 2012 11:32:54 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed myapp/war/WEB-INF/appengine-web.xml
Dec 19, 2012 11:32:54 AM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed myapp/war/WEB-INF/web.xml
Dec 19, 2012 11:32:54 AM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed myapp/war/WEB-INF/cron.xml
Dec 19, 2012 11:32:54 AM com.google.apphosting.utils.config.IndexesXmlReader readConfigXml
INFO: Successfully processed myapp/war/WEB-INF/datastore-indexes.xml
Dec 19, 2012 11:32:54 AM com.google.apphosting.utils.config.IndexesXmlReader readConfigXml
INFO: Successfully processed myapp/war/WEB-INF/appengine-generated/datastore-indexes-auto.xml
Beginning server interaction for myappid…
0% Beginning to retrieve log records…
25% Received 100 log records…
43% Received 200 log records…
57% Received 300 log records…
67% Received 400 log records…
75% Received 500 log records…
81% Received 600 log records…
85% Received 700 log records…
88% Received 800 log records…
91% Received 887 log records…
Success.
Cleaning up temporary files…