0

Standard start of rails log message is like this:

Started GET "/newrelic" for 192.168.18.36 at 2013-09-04 15:19:34 +0200

But I would like to have something like this:

[request_id] Started GET "/newrelic" for 192.168.18.36 at 2013-09-04 15:19:34 +0200

Is it possible to achevie this?

Sławosz
  • 11,187
  • 15
  • 73
  • 106

1 Answers1

1

Yes, it's possible. You can achieve this by using config.log_tags. The log_tags option was added in Rails 3.2 and can be used to prepend information to each log message.

In /config/environments/development.rb

MyApp::Application.configure do
  config.log_tags = [:request_id]
  ...
end
Chawarong Songserm PMP
  • 1,734
  • 1
  • 14
  • 19