Reputation: 10403
Reading a Rails
log with vim
, we can see a colored log.
But when we use tail -f
or less
to watch the log, it isn't colorized anymore. Is there any way to see the colored log with tail
or less
or whatever?
Upvotes: 12
Views: 7232
Reputation: 1105
tail -f log/development.log | ccze -A
You may need to install ccze
sudo apt-get install ccze
it works better, not ideal but works
Upvotes: 8
Reputation: 84172
pass -R
to less for it to let colour escape sequences pass through, i.e.
less -R log/development.log
This should result in them being displayed in colour, assuming you are using the proper terminal type
Upvotes: 22
Reputation: 4515
You can't do that out of the box, since tail and less know nothing about Rails, and logs are saved a simple text files. You could use regular expressions to colorize output but I doubt it's worth the trouble.
EDIT: see alfonso's comment for some alternatives.
Upvotes: 1