开发者

Rails: Show SQL Queries in Production Log

How can we enabled SQL query logging in production environment?

Tha开发者_开发百科nks,

Imran


In your environments/production.rb

config.log_level = :debug

Remember you need to restart the web server to apply the changes.


If you're setting the production log level to debug, I would recommend you to set the log level with an environment variable. Log level debug is much bigger than info and it can easily grow out of control or quotas if you're using a log service. So, with an environment variable you can change it faster only restarting rails, without the need for changing the code and deploy:

config.log_level = (ENV['LOG_LEVEL'] || :debug)

This way, you optionally set the environment variable LOG_LEVEL to change it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜