The default for production.rb is:
config.log_level = :info
However, I really like to see the SQL queries and extra logging in my production environment.
Changing the log level to:
config.log_level = :debug
Is this a terribly bad practice? How much overhead does this add to my application to have Rails do this extra logging?
The WARN level is the level that should be active in production systems by default, so that only WARN and ERROR messages are being reported, thus saving storage capacity and performance.
In a Rails app, logs are stored under the /log folder. In development mode, the development. log file is used & you see log output on the terminal you're running rails server on.
Rails uses six different log levels: debug, info, warn, error, fatal, and unknown. Each level defines how much information your application will log: Debug: diagnostic information for developers and system administrators, including database calls or inspecting object attributes. This is the most verbose log level.
If you want to know the current log level, you can call the Rails. logger. level method. This is useful when you want to log under development or staging without flooding your production log with unnecessary information.
It's simply a question of how large a log file you're willing to deal with. I suggest setting it to :debug
for a few days, and then decide based on the resulting log sizes. This is a decision that may change day-to-day, based also on what you need debugged, and how many and how verbose your debug statements are.
For your reference below are some links for rails best practices that I found while Googling:
Best Practices for a Web App Staging Server (on a budget)
http://kpumuk.info/ruby-on-rails/flexible-application-configuration-in-ruby-on-rails/
http://railsware.com/blog/2013/10/16/rails-configuration-in-the-proper-way/
Best practices for Ruby on Rails *feature* deployment?
Here is rails 4 production logging and new features:
http://rubyjunky.com/cleaning-up-rails-4-production-logging.html
Also in other way you can do it with easily by taking back up of production DB on your local machine and test / debug those data in the way that you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With