2015-04-03 39 views
0

這裏是一個項目,我的工作:https://github.com/homanchou/the_drawing_challenge軌4.2無法看到的Heroku的數據庫查詢記錄,即使LOG_LEVEL設置爲:調試

我無法看到所有的數據庫查詢服務器登錄在運行彪馬工頭時,甚至可以在終端本地。

所有我看到的是資產或Web請求

21:54:34 web.1 | started with pid 54784 
21:54:35 web.1 | [54784] Puma starting in cluster mode... 
21:54:35 web.1 | [54784] * Version 2.10.2 (ruby 2.1.5-p273), codename: Robots on Comets 
21:54:35 web.1 | [54784] * Min threads: 1, max threads: 4 
21:54:35 web.1 | [54784] * Environment: development 
21:54:35 web.1 | [54784] * Process workers: 2 
21:54:35 web.1 | [54784] * Preloading application 
21:54:36 web.1 | [54784] * Listening on tcp://0.0.0.0:5000 
21:54:36 web.1 | [54784] Use Ctrl-C to stop 
21:54:36 web.1 | [54784] - Worker 0 (pid: 54785) booted, phase: 0 
21:54:36 web.1 | [54784] - Worker 1 (pid: 54786) booted, phase: 0 
21:54:43 web.1 | [54785] 127.0.0.1 - - [02/Apr/2015:21:54:43 -0700] "GET/HTTP/1.1" 200 - 0.3120 
21:54:43 web.1 | [54785] 127.0.0.1 - - [02/Apr/2015:21:54:43 -0700] "GET /logo_header.png HTTP/1.1" 304 - 0.0079 
21:54:45 web.1 | [54785] 127.0.0.1 - - [02/Apr/2015:21:54:45 -0700] "GET /challenges/8 HTTP/1.1" 200 - 0.0443 
21:54:45 web.1 | [54785] 127.0.0.1 - - [02/Apr/2015:21:54:45 -0700] "GET /logo_header.png HTTP/1.1" 304 - 0.0067 

我只好到另一行添加到Procfile log: tail -f -n 0 log/development.log看到的foreman start標準輸出日誌或錯誤,像我通常做,但只能在本地,而不是在heroku上,除非我想擴大拖尾的過程。

在我的其他軌道項目中,我可以看到的數據庫查詢罰款,甚至在Heroku上我可以看到日誌中的數據庫查詢:

2015-04-03T03:46:40.052067+00:00 app[web.1]: Started GET "/api/notifications/unread_count" for 97.93.34.8 at 2015-04-03 03:46:40 +0000 
2015-04-03T03:46:40.070865+00:00 app[web.1]: Merchant Load (2.7ms) SELECT "merchants".* FROM "merchants" WHERE "merchants"."id" = $1 ORDER BY "merchants"."id" ASC LIMIT 1 [["id", 7502]] 
2015-04-03T03:46:40.085454+00:00 app[web.1]: SQL (2.3ms) UPDATE "merchants" SET "updated_at" = '2015-04-03 03:46:40.074442', "last_active_at" = '2015-04-03 03:46:40.074442' WHERE "merchants"."id" = $1 [["id", 7502]] 
2015-04-03T03:46:40.101382+00:00 app[web.1]: (2.3ms) SELECT COUNT(*) FROM "notifications" WHERE "notifications"."merchant_id" = $1 AND "notifications"."state" = $2 [["merchant_id", 7502], ["state", "unread"]] 
2015-04-03T03:46:40.058083+00:00 app[web.1]: Processing by NotificationsController#unread_count as JSON 
2015-04-03T03:46:40.073916+00:00 app[web.1]: (1.0ms) BEGIN 
2015-04-03T03:46:40.093737+00:00 app[web.1]: (7.4ms) COMMIT 
2015-04-03T03:46:40.102858+00:00 app[web.1]: Completed 200 OK in 45ms (Views: 0.2ms | ActiveRecord: 15.6ms) 

我試圖比較兩個甚至複製了一些環境配置,但我仍然無法弄清楚。我試過在生產環境中設置config.log_level =:debug。我可以在ruby控制檯中看到db查詢,但不能在終端中看到heroku或本地puma標準輸出。我錯過了什麼?

+0

看到http://stackoverflow.com/questions/6427096/heroku-see -params和-SQL活性功能於日誌 – user1322092 2015-05-10 11:16:20

回答

0

如果你需要使用的PUMA等的WebSockets嘗試添加

ActiveRecord::Base.logger.level = Logger::DEBUG 

您environments.rb或環境/生產

相關問題