开发者

Rails: Show SQL Queries in Production Log

开发者 https://www.devze.com 2023-01-22 10:41 出处:网络
How can we enabled SQL query logging in production environment? Tha开发者_开发百科nks, ImranIn your environments/production.rb

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

精彩评论

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

关注公众号