Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails - how to disable all console logging?

Coming from a javascript background, I find the command line while running rails to be cluttered. Every time something happens, my command line is filled with a bunch of crap. E.g:

[2013-06-19 20:25:53] WARN  Could not determine content-length of response body.
 Set content-length of the response or set Response#chunked = true

How do I turn this off so that I only see my own logs(and errors, of course)?

Any help is appreciated!

like image 294
starscape Avatar asked Jun 20 '13 00:06

starscape


3 Answers

Try changing the log level, which is info by default.

From the Guides: http://guides.rubyonrails.org/debugging_rails_applications.html#log-levels

like image 78
brewp Avatar answered Nov 13 '22 11:11

brewp


Change the log level in config/environments/development.rb, and/or testing.rb:

config.log_level = :error

The log levels available are: :debug, :info, :warn, :error, :fatal, and :unknown, which correspond to the integers 0-5.

like image 7
Zaz Avatar answered Nov 13 '22 11:11

Zaz


You can turn off the SQL queries. I know they take a lot of room.

Disable Rails SQL logging in console

like image 1
dnelson Avatar answered Nov 13 '22 12:11

dnelson