Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid a rails 3 app from saving in development.log?

I want to keep my rails 3 app from saving all the development logs in the development.log because its making my file bigger.

like image 658
johan Avatar asked Dec 07 '22 22:12

johan


2 Answers

You can either do this in your:

application.rb

Or if you only want to disable for specific environments do this in the specific env config, in your case:

config/environments/development.rb

You're probably looking for some or all of the following settings:

config.logger
config.active_record.logger
config.action_controller.logger
config.action_view.logger
config.action_mailer.logger
config.active_resource.logger

If you set any of them to nil e.g.:

config.active_record.logger = nil

It should disable logging for that specific component. You can experiment with these to disable logging for specific components or set all of them to nil to get no logging.

like image 95
skorks Avatar answered Jan 12 '23 11:01

skorks


Switching it entirely off is a very bad idea. You can make it put less transactions in it by specifying a log level like:

config.log_level = :info

in the config/environments/development.rb file. For the various options look here:

http://guides.rubyonrails.org/configuring.html

like image 20
GrahamJRoy Avatar answered Jan 12 '23 10:01

GrahamJRoy