LoginSignup
4
4

More than 5 years have passed since last update.

Rails3のログがApacheで複数プロセス走ると混ざって解析できなくなるのに対応する方法

Last updated at Posted at 2013-02-01

config/application.rb or config/enviroments/production.rb

config.log_tags = [:uuid]

とすると、以下のように

[fdfb18680c27a2e0edb94bd2f1bdccd4] Started GET "/" for 127.0.0.1 at 2013-02-01 19:00:57 +0900
[fdfb18680c27a2e0edb94bd2f1bdccd4] Processing by Home::EntriesController#index as HTML
[00af38e7a0fc3b52757706e58cc17ab3] Started GET "/groups/my.js?_=1359712869432" for 127.0.0.1 at 2013-02-01 19:01:09 +0900
[00af38e7a0fc3b52757706e58cc17ab3] Processing by Home::GroupsController#my as JS

先頭にリクエストごとに一意になる uuid が付与されるようになるので、複数プロセスのログが混ざりこんでも、どのログが1トランザクションなのか分かるようになります。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4