Rails - 在日志文件中查看生成的SQL查询

时间:2021-10-18 22:02:03

Is there a way to see all generated queries from rails in production environment like you can in development?

有没有办法在生产环境中看到所有生成的查询,就像在开发中一样?

1 个解决方案

#1


11  

Yes you can. If you go in the config/environments/production.rb file, there's a section like this:

是的你可以。如果你进入config / environments / production.rb文件,有一个这样的部分:

# See everything in the log (default is :info)
# config.log_level = :debug

Uncomment the config.log_level line, and you'll get the same log in production as you would in dev.

取消注释config.log_level行,您将获得与开发中相同的生产日志。

#1


11  

Yes you can. If you go in the config/environments/production.rb file, there's a section like this:

是的你可以。如果你进入config / environments / production.rb文件,有一个这样的部分:

# See everything in the log (default is :info)
# config.log_level = :debug

Uncomment the config.log_level line, and you'll get the same log in production as you would in dev.

取消注释config.log_level行,您将获得与开发中相同的生产日志。