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

17 Dec 2013 Donoku
28 Dec 2012 How to make SublimeLinter work with Ruby & RVM
09 Dec 2012 The tech behind getting Blizzalert into its third season
03 Nov 2012 Little-Corner is now a Heroku-ready Rails app
14 Oct 2012 Sip as a replacement for Pick as a replacement for Digital Color Meter in Mac OS X