Using TextMate with Rails .log Files


#1

When I open up my Rails .log files in TextMate, I see some kind of
coding (e.g. [4;36;1mSQL ) in the log. I assume this is for color
coding or something of the text. How can I get TextMate to render it
correctly?

Thanks,
Tom


#2

Tom wrote:

When I open up my Rails .log files in TextMate, I see some kind of
coding (e.g. [4;36;1mSQL ) in the log. I assume this is for color
coding or something of the text. How can I get TextMate to render it
correctly?

Thanks,
Tom

Open up a console and type this instead…

tail -f log/development.log


#3

_Kevin wrote:

Tom wrote:

When I open up my Rails .log files in TextMate, I see some kind of
coding (e.g. [4;36;1mSQL ) in the log. I assume this is for color
coding or something of the text. How can I get TextMate to render it
correctly?

Thanks,
Tom

Open up a console and type this instead…

tail -f log/development.log

…which doesn’t really answer the question :slight_smile:

Not that I can, I have to say, just that trying to open it in an editor
is something you might do because viewing it in a console isn’t rich
enough.

So how to open a log file in TextMate ?

The codes are just ANSI colour coding for display in a colour xterm. It
should be possible to have a doctype for TextMate that will open them
correctly. The problem is, of course, that while they are display info,
they are also textual content, and TextMate would be getting dangerous
if it started stripping characters out of the file for display
purposes…what would it do if you made a change and then saved ?

A better bet might be to find a way to strip them out and produce a
‘clean’ log file.

Alternatively, set ActiveRecord::Base.colorize_logging to false in your
environment and rerun whatever you were trying to do ?

Alan


#4

Alan,

Thanks for the explanation! The ActiveRecord::Base.colorize_logging
will do exactly what I need!

Thanks again,
Tom