How to View Rails Log "Colorfully" in Windows

I was learning Ruby on Rails recently and it’s pretty impressive that Rails has done almost every annoying settings and configurations for you….ok, this post isn’t about saying good words for RoR. I want to show my tiny survey on “how to view the Rails log file in Windows”.

As default, Rails produces a very nice log file under the directory “%project_home%/log”, recording detail information of every request, such as path, parameters, session data, SQLs… They are nicely indented and colored by some ascii color controlling characters (I don’t know the exact name of these characters… anyone who knows that please tell me, thank you), but the console in Windows doesn’t support that. So the log will appear like below in windows console.

rails_log_windows

The “tail” command here is from GNUWin32 CoreUtils.

Apparently this is far from nice…

After tried some tools, including UltraEdit, RadRails (console window), Tail for Win32. I surprisingly found a small tool AsciiArtViewer (author’s homepage, download link) can display these color controlling stuff correctly… But this tool can’t work like the tail command (updating realtimely), so I continued my search.

Finally I got a good tool – MinGW-msys. Actually it’s a Minimal SYStem, based on MinGW and offering a Bourne Shell environment. It has the built-in “tail” command and displays color controlling characters correctly. The download page is here, and what you should look for is “MSYS Base System“. I’m using MSYS-1.0.10.exe.

rails_log_msys

The color theme of msys console can be configured by editing the file “c:\msys\1.0\msys.bat”.

————

Some co-worker told me in RadRails it’s also possible to get a pretty format. Right click the log file in resource navigator and choose “Tail” :)

————

Another update, Install Cygwin and add the “bin” directory of cygwin to system path, then everything will be fine….It’s a shame not to realize this earlier =_=

Join the Conversation

3 Comments

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.