Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable all CLI test logs in Rails 4?

I've managed to disable the ActiveRecord related logs by setting config.active_record.logger = nil in config/environments/test.rb

I'm still getting the following outputs however:

Processing by Admin::WebsitesController#edit as HTML
  Parameters: {"id"=>"226"}
  Rendered admin/websites/_form.html.erb (6.8ms)
  Rendered admin/websites/edit.html.erb within layouts/application (7.2ms)
Completed 200 OK in 36ms (Views: 33.5ms | ActiveRecord: 0.0ms)

I've tried the following options but they didn't help:

ActiveRecord::Base.logger = nil
config.action_controller.logger = nil
config.action_view.logger = nil

What am I missing?

like image 400
mind.blank Avatar asked Nov 28 '13 15:11

mind.blank


1 Answers

Try setting the application log level to :fatal or 4 (they are one and the same). E.g. in config/environments/test.rb:

config.log_level = :fatal

See the Rails Guides for more info, like the available log levels:

The available log levels are: :debug, :info, :warn, :error, :fatal, and :unknown, corresponding to the log level numbers from 0 up to 5 respectively.

like image 105
lime Avatar answered Oct 02 '22 12:10

lime