16 Jul 2012

How to Use Console to view the log files for your Rails App


By viewing the log for your Rails app from within Console, you can quickly clear your view of the log between tests so that you don't have to sift through irrelevant data. Just use the Clear Display button before accessing the site. It's non-destructive, so navigating away from the log file & then viewing it again will display the entire log file. You can also delete the log file right from Console to keep it from getting out of hand.

If you're using Pow, run these commands in the Terminal:

cd ~/Library/Logs/Pow/apps
ln -s /path/to/your/rails/app/log name-of-your-rails-app

Now you can view the logs in Console under the FILES section in ~/Library/Logs/Pow/apps/name-of-your-rails-app/development.log

If you're not using Pow (you're not using Pow?!), run these commands in the Terminal:

cd ~/Library/Logs
mkdir Rails
cd Rails
ln -s /path/to/your/rails/app/logs name-of-your-rails-app

Now you can view the logs in Console under the FILES section in ~/Library/Logs/Rails/name-of-your-rails-app/development.log

Update:

Mountain Lion removed the feature of Console being able to display symlinked folders. I've looked around for another way to add folders to Console, but I haven't found anything really useful yet.

The only fix I have at the moment is to ⌘-o within Console, navigate into the symlink in Pow's log folder, and open the development.log file. This will keep the file open in Console, at the bottom of the log list. It's a serious pain for anyone with multiple Rails apps, though, because then they're all listed in Console as 'development.log'.

Tags

console development mac mac-os-x pow rails ruby-on-rails terminal

Related Posts

16 Oct 2009 Holyoke's Center City Vision Plan
13 Jun 2012 Pow makes multi-site Rails apps EASY
28 Oct 2009 Relevant Exploration Through Google Reader
04 Nov 2009 Some Fantastic Mac And iPhone Applications
21 Oct 2009 Navigate Your Brain