Rails: Show SQL Queries in Production Log

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.


In your environments/production.rb

config.log_level = :debug

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