Forum: Ruby on Rails Using TextMate with Rails .log Files

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5f3d52658aafcf0aabe76a5147e8909f?d=identicon&s=25 Tom (Guest)
on 2007-01-03 23:54
(Received via mailing list)
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
5f23b06d22b84ec6c902bf390071a79c?d=identicon&s=25 _Kevin (Guest)
on 2007-01-04 00:51
(Received via mailing list)
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
4daf0b71d5d9a3882e583c0e72eaf5dc?d=identicon&s=25 Alan Francis (Guest)
on 2007-01-04 13:10
_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 :-)

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
5f3d52658aafcf0aabe76a5147e8909f?d=identicon&s=25 Tom (Guest)
on 2007-01-06 19:18
(Received via mailing list)
Alan,

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

Thanks again,
Tom
This topic is locked and can not be replied to.