mind.blank
mind.blank

Reputation: 4880

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?

Upvotes: 5

Views: 2377

Answers (1)

lime
lime

Reputation: 7111

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.

Upvotes: 13

Related Questions