2015-04-03 38 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或环境/生产

相关问题