openshift/origin-server — pull request #1087 by fotioslindiakos (2012-12-19 02:12:01+00:00)
Title: Adds support for logging the entire REST request/response

To use, either set `config.rest_api_debug = true` in your `environments/*.rb` or launch the console with `REST_API_DEBUG=1 rails server`.

This will log the entire request/response to `#{Rails.root}/log/rest_api.log` (it will fall back to `#{Rails.root}/tmp` or `/tmp`. It uses a separate file so as to not clutter the main log file with hundreds of lines of JSON (and doesn't clutter the REST logging with lots of assets logging and such).

The main log now includes a shortened version of the `x-request-id` which can be used to correlate requests with the `rest_api.log` or potentially the broker/Apache.

An example can be found here: https://gist.github.com/9a5a4a39fad2b4d7aab0