Binary / ESC in dev log

My production log looks okay, but when I less my development log it
first asks ‘“log/development.log” may be a binary file. See it anyway?’
and it looks like this:

ESC[4;35;1mSQL (0.075510)ESC[0m ESC[0m SELECT a.attname,
format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = ‘sites’::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
ESC[0m

What’s with the ESC’s? Do I need to change some setting?

Thanks,
Joe

Those are ANSI color codes.

In your environment.rb (with a recent Rails):

Rails::Initializer do |config|
(…)
config.active_record.colorize_logging = false
(…)
end

See http://glu.ttono.us/articles/2006/05/22/configuring-rails-
environments-the-cheat-sheet for a good list of configuration options.


Brad E.
Cell 479 228-1710

Ahh…thanks! Looks like more handles them by default whereas less
requires the -R option. Though it still prompts me if I want to see a
binary file – I can’t figure out how to make that go away.

Joe

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs