简体   繁体   中英

rails 5 hide production output unique request identifier

A unique identifier is showing before every request output (dev server) Here an example:

$ rails s
=> Booting Puma
=> Rails 5.0.3 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.10.0 (ruby 2.4.1-p111), codename: Russell's Teapot
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
[5664e61d-73e6-4ce3-af27-d82aa04abebd] Started GET "/plans" for 127.0.0.1 at 2017-10-17 17:06:48 -0300
[5664e61d-73e6-4ce3-af27-d82aa04abebd] ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
[5664e61d-73e6-4ce3-af27-d82aa04abebd] DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from <class:ApplicationController> at /Users/tdonatti/Sites/rails/vmsapi/app/controllers/application_controller.rb:10)
[5664e61d-73e6-4ce3-af27-d82aa04abebd] Processing by PlansController#index as HTML
[5664e61d-73e6-4ce3-af27-d82aa04abebd] User Load (0.4ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2  [["id", 9], 
["LIMIT", 1]]
[5664e61d-73e6-4ce3-af27-d82aa04abebd] Plan Load (0.4ms)  SELECT "plans"."id", "plans"."title", "plans"."nod", "plans"."price", "plans"."status" FROM "plans"
[5664e61d-73e6-4ce3-af27-d82aa04abebd] Completed 200 OK in 38ms (Views: 9.4ms | ActiveRecord: 7.4ms)

I want to hide this identifier [5664e61d-73e6-4ce3-af27-d82aa04abebd]

I am not sure why and how it shows up but make the output extremely noisy and difficult to track.

In your config file you must have log_tags set to something like

config.log_tags = [ :uuid ]

Remove that and you should be good to go.

Log tags are beneficial for debugging - give this a read when you have time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM