Debugging under Passenger
Jeroen Bulters do 18 mrt 10
Sometimes… you just have to debug something in a ‘live’ (i.e. staging) environment. Or you just enjoy using Passenger as a development platform. Either way, when using Passenger, you lose the plain-old “—debugger” option which – in my opinion – has proven itself to be indispensible to debug Rails applications. Luckily, there is a solution: ruby-debug.
To use ruby-debug with passenger, we specify the following in our environment file (be it production or development):.
if File.exists?(File.join(Rails.root,'tmp', 'debugger.txt')) require 'ruby-debug' Debugger.wait_connection = true Debugger.start_remote File.delete(File.join(Rails.root,'tmp', 'debugger.txt')) end
Starting a debugger waiting for a remote connection if the debugger.txt file exists in our tmp directory. Just touch both the tmp/debugger.txt file and the tmp/restart.txt file and a debugger session will be waiting for you as soon as the Passenger process has respawned.
Connect with the debugger with “rdebug -c”; et voila!
One drawback, the incredibly handy irb function of rdb is not available in remote-mode.
Gepost in hor | 0 reacties
Welcome to Holland On Rails
This weblog is the official Ruby techblog from the guys at Holder, a Ruby development company. Holder is also the company behind the RubyAndRails Europe Conference in Amsterdam.Recente Jobs
Bekijk alle jobs »»
Gereedschapskist
Onmisbare tools vooriedere developer!
- Ruby On Rails
Framework voor de web 2.0 developer. Eindelijk vooruitgang! - TextMate
Editor for true pro's
Typ, tab, top :-)
Nee, niet voor Win. - Made On A Mac
En nou is het over met die saaie grijze Windows bak van je!
Auteurs op deze site
Chris Obdam
'Less is more' evangelist, past dit ook dagelijks toe op zijn tandenborstel.Chiel Wester
Snelheidswonder op Ruby wielen. Leuk om mee te pair-programmen ;-)
Plaats je reactie