Download / export Google App Engine Logs, Java App

In GAE, Java App, you can use command “appcfg request_logs” to download or export the logs from GAE to your computer, see signature below :

AppCfg [options] request_logs <app-dir> <output-file>

You can type “appcfg request_logs” to view all available options.

1. What is <app-dir> ?

This is NOT your app_id nor any deployed web path from GAE, this is your local project folder, contains files :

  1. WEB-INF/appengine-web.xml
  2. WEB-INF/web.xml

The GAE Java SDK, command “appcfg” is hard-coded to find above two files. To download logs from GAE, you must provide above two XML files in “WEB-INF” folder, which is not make sense, but you have no choice but follow GAE way of doing things.

In my opinion, the better way should be

AppCfg [options] request_logs <app-id-on-GAE> <output-file>

Note
If you don’t have the XML files but still want to download the logs, you can issue appcfg download_app to download the deployed application which included the XML files.

2. Examples

Following are some common examples to download logs from GAE.

1. Download today logs from GAE to “c:\gae.log”.

C:\appengine-java-sdk-1.6.3.1\bin> 
appcfg request_logs C:\workspace-3.7\SpringGAEProject\war\ c:\gae.log

2. Download all logs from GAE to “c:\gae.log”.

C:\appengine-java-sdk-1.6.3.1\bin>
appcfg --num_days=0 request_logs C:\workspace-3.7\SpringGAEProject\war\ c:\gae.log

P.S By default, –num_days=1

3. Download all logs, with severity=4 from GAE to “c:\gae.log”.

C:\appengine-java-sdk-1.6.3.1\bin>
appcfg --num_days=0 --severity=4 request_logs C:\workspace-3.7\SpringGAEProject\war\ c:\gae.log

P.S Severity is the logging level in logs. The range is 0 (DEBUG) through 4 (CRITICAL).

4. Download all logs from GAE and append to “c:\gae.log”.

C:\appengine-java-sdk-1.6.3.1\bin>
appcfg --num_days=0 --append request_logs C:\workspace-3.7\SpringGAEProject\war\ c:\gae.log

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s