# Using TextMate with Rails .log Files

**URL:** <https://www.ruby-forum.com/t/using-textmate-with-rails-log-files/81107>\
**Category:** Rails\
**Created:** [January 3, 2007, 11:54pm UTC](https://www.ruby-forum.com/t/using-textmate-with-rails-log-files/81107 "2007-01-03T23:54:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@tom](https://www.ruby-forum.com/u/tom)\
**Post date:** [January 3, 2007, 11:54pm UTC](https://www.ruby-forum.com/t/using-textmate-with-rails-log-files/81107/1 "2007-01-03T23:54:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@tom](https://www.ruby-forum.com/u/tom)\
**Post date:** [January 4, 2007, 12:51am UTC](https://www.ruby-forum.com/t/using-textmate-with-rails-log-files/81107/2 "2007-01-04T00:51:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@tom](https://www.ruby-forum.com/u/tom)\
**Post date:** [January 4, 2007, 1:10pm UTC](https://www.ruby-forum.com/t/using-textmate-with-rails-log-files/81107/3 "2007-01-04T13:10:57Z")

</div>

\_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

---

<div class="post-metadata">

**Author:** ![tom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3d9bf3/32.png) [@tom](https://www.ruby-forum.com/u/tom)\
**Post date:** [January 6, 2007, 7:18pm UTC](https://www.ruby-forum.com/t/using-textmate-with-rails-log-files/81107/4 "2007-01-06T19:18:03Z")

</div>

Alan,

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

Thanks again,  
Tom
