在我的开发环境中,当我在我的应用程序上发出请求时,我会看到如下 AREL 和 SQL 查询:
Started GET "/products/20" for 127.0.0.1 at 2012-12-31 19:18:40 -0500
Processing by ProductsController#show as HTML
Parameters: {"id"=>"20"}
Category Load (0.2ms) SELECT "categories".* FROM "categories" LIMIT 6
Product Load (0.1ms) SELECT "products".* FROM "products" WHERE "products"."id" = ? LIMIT 1 [["id", "20"]]
Product Load (0.3ms) SELECT "products".* FROM "products"
Vendor Load (0.2ms) SELECT "vendors".* FROM "vendors" WHERE "vendors"."id" = 11 LIMIT 1
Product Load (0.2ms) SELECT "products".* FROM "products" WHERE "products"."vendor_id" = 11
(0.2ms) SELECT COUNT(*) FROM "categories" INNER JOIN "category_products" ON "categories"."id" = "category_products"."category_id" WHERE "category_products"."product_id" = 20
Category Load (0.1ms) SELECT "categories".* FROM "categories" INNER JOIN "category_products" ON "categories"."id" = "category_products"."category_id" WHERE "category_products"."product_id" = 20
CACHE (0.0ms) SELECT "vendors".* FROM "vendors" WHERE "vendors"."id" = 11 LIMIT 1
CACHE (0.0ms) SELECT "vendors".* FROM "vendors" WHERE "vendors"."id" = 11 LIMIT 1
Rendered products/_similar_products.html.erb (6.1ms)
Rendered products/show.html.erb within layouts/application (71.2ms)
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
(0.2ms) SELECT COUNT(*) FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = 1 AND (((roles.name = 'superadmin') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))
Rendered layouts/_login_nav.html.erb (5.1ms)
Rendered layouts/_navigation.html.erb (0.9ms)
Rendered layouts/_header.html.erb (76.4ms)
Rendered layouts/_messages.html.erb (0.3ms)
Rendered layouts/_footer.html.erb (0.1ms)
Completed 200 OK in 1171ms (Views: 1160.9ms | ActiveRecord: 1.9ms)
但这是在 Heroku 上的相同查询:
2013-01-01T00:24:57+00:00 app[web.1]: Started GET "/products/20" for 67.230.41.62 at 2013-01-01 00:24:57 +0000
2013-01-01T00:24:58+00:00 heroku[router]: at=info method=GET path=/products/20 host=myapp.herokuapp.com fwd=67.230.41.62 dyno=web.1 queue=0 wait=0ms connect=1ms service=59ms status=200 bytes=7718
我正在跟踪我的 Heroku 日志heroku logs --tail
,这就是我获取该信息的方式。
是否可以获得与我在 Heroku 开发环境中看到的相同类型的日志?
谢谢。
编辑:
在我的config/environment.rb
我放了这个:
ActiveRecord::Base.logger.level = Logger::DEBUG
在config/environment/production.rb
我放这个:
config.log_level = :debug