Saturday, June 7, 2008

Debugging a live Ruby on Rails server

This just something useful that occurred to me that is probably blindingly obvious to seasoned rails people out there.

We have a Rails application hosted with Apache and a Mongrel cluster running in production mode. That means if something goes bang, to see what happened you have to go to /log/production.log to see what happened. This system is for internal use to its considered acceptable to reproduce problems quickly on the server and even fix there and copy back to the repository. Mainly because thats much faster. The problem is that you have to restart the cluster every time you change anything.

What occured to me was that to reproduce bugs I could leave the cluster running normally, but just start another instance of the application running on another port in development mode by doing:

script/server -p 4000

I can then hit the controllers running on those pages and see the error messages and trace.

So there you go - a bit trivial, but it saved me some time yesterday.

No comments: