back to notes

Rails Colorize Logging

"Rails::Subscriber.colorize_logging

Tells Rails whether to use ANSI codes to colorize the logging statements. The colors make it much easier to read the logs (except on Windows) and may complicate matters if you use software like syslog. Defaults to true. Change to false if you view your logs with software that doesn’t understand the ANSI color codes.

Here’s a snippet of log output with the ANSI codes visible:

1 ^[[4;36;1mSQL (0.0ms)^[[0m ^[[0;1mMysql::Error: Unknown table
2 'expense_reports': DROP TABLE expense_reports^[[0m
3 ^[[4;35;1mSQL (3.2ms)^[[0m ^[[0mCREATE TABLE expense_reports ('id'
4 int(11) DEFAULT NULL auto_increment PRIMARY KEY, 'user_id' int(11))

"


last updated may 2014