RequestId

Rails plugin that adds a new method (Controller#request_id) to distinguish requests

Methods

  • ActionController::Base#request_id

    > “3000:1” # request_id_with_port is true

    > “1” # request_id_with_port is false

Configurations

  • ActionController::Base.request_id_with_port

    Indicates whether request_id needs port number or not. It is useful under clustered servers. This is true, by default.

Log

  • Request ID field is automatically added into log file

Processing UserController#index (for 127.0.0.1 at 2008-11-16 21:30:00) [GET]

Request ID: 3000:1

Processing UserController#index (for 127.0.0.1 at 2008-11-16 21:30:05) [GET]

Request ID: 3000:2

Note

  • request_id is reset when the server restarts

  • backend_port is used as port number only on Mongrel server, otherwise frontend_port is used. Anyone know how to detect backend port number on Lighttpd, WEBrick and Thin?

Copyright © 2008 [email protected], released under the MIT license