Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to turn off ANSI escape color codes in rails 4 logs

In my rails 4 logs I get a log of garbage like this:

^{[1m^{[36mPerson Load (0.7ms)^{[0m  ^{[1mSELECT  "people".* FROM "people" 
  WHERE "people"."id" = $1 LIMIT 1^{[0m  [["id", 673143]]

How can I tell rails 4 to turn this coloring off ?

I tried to add config.active_record.colorize_logging = false to config/application.rb but I got this error:

/home/sweerasinghe/trunk_1509171953/vendors/ruby-2.2.2/ruby/2.2.0/gems/activerecord-4.2.1/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `colorize_logging=' for ActiveRecord::Base:Class (NoMethodError)

like image 646
oystersauce8 Avatar asked Oct 05 '15 16:10

oystersauce8


1 Answers

You want this:

config.colorize_logging = false

This is documented in the Rails General Configuration section of the Configurating Rails Applications Rails Guide.

like image 60
Jordan Running Avatar answered Oct 16 '22 04:10

Jordan Running