<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Passenger (mod_rails) for development. Now with debugger!</title>
	<atom:link href="http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger/feed" rel="self" type="application/rss+xml" />
	<link>http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger</link>
	<description>Ruby, Rails and tech. No ducks were harmed in the making of this blog.</description>
	<lastBuildDate>Sun, 11 Mar 2012 16:15:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dave James Miller</title>
		<link>http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger/comment-page-1#comment-143</link>
		<dc:creator>Dave James Miller</dc:creator>
		<pubDate>Sun, 11 Mar 2012 16:15:36 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=17#comment-143</guid>
		<description>Thanks, even though it&#039;s 3½ years later that&#039;s still very useful! I&#039;ve made it into a Gem to make it even easier to install: https://github.com/davejamesmiller/ruby-debug-passenger</description>
		<content:encoded><![CDATA[<p>Thanks, even though it&#8217;s 3½ years later that&#8217;s still very useful! I&#8217;ve made it into a Gem to make it even easier to install: <a href="https://github.com/davejamesmiller/ruby-debug-passenger" rel="nofollow">https://github.com/davejamesmiller/ruby-debug-passenger</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Groxx</title>
		<link>http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger/comment-page-1#comment-118</link>
		<dc:creator>Groxx</dc:creator>
		<pubDate>Wed, 01 Jun 2011 02:36:01 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=17#comment-118</guid>
		<description>Many thanks, David Esposito, that works for me!

To others out there trying to get it to work: just copy &amp; paste the debugger initialization into David Esposito&#039;s wrapper.  `rake restart DEBUG=true` and you&#039;re good to go!  The debugger can be connected well in advance of the breakpoints if you have one further into your application.</description>
		<content:encoded><![CDATA[<p>Many thanks, David Esposito, that works for me!</p>
<p>To others out there trying to get it to work: just copy &amp; paste the debugger initialization into David Esposito&#8217;s wrapper.  `rake restart DEBUG=true` and you&#8217;re good to go!  The debugger can be connected well in advance of the breakpoints if you have one further into your application.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Esposito</title>
		<link>http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger/comment-page-1#comment-106</link>
		<dc:creator>David Esposito</dc:creator>
		<pubDate>Thu, 23 Sep 2010 12:31:30 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=17#comment-106</guid>
		<description>A couple of notes:

I&#039;m not sure when the spawning code was added/changed in Passenger, but the code above will not work with Passenger 2.2.4. Putting the code to launch the debugger in environment.rb (or development.rb) means that it launches within the ApplicationSpawner process and the Rails requests are handled in separate worker processes so your breakpoints will never get hit.

Section 11.3 of the Passenger guide gives a technique for ensuring that you can hook the spawning of a new request handler. You&#039;ll want to put the code outlined above in the &#039;if forked&#039; block. You will need a little extra code to preserve the state of debug.txt (whether it existed when Apache was tickled) and if your Passenger is configured to allow multiple workers (the default), you&#039;ll have trouble identifying which listener is debugging which process

http://www.modrails.com/documentation/Users%20guide.html#spawning_methods_explained

Lastly, you can debug your Rails app from NetBeans by using the &#039;ruby-debug-ide&#039; gem instead of the &#039;ruby-debug&#039; gem.

Here&#039;s my code in development.rb (it launches the debugger every time without regard to debug.txt)

if defined?(PhusionPassenger)
    PhusionPassenger.on_event(:starting_worker_process) do &#124;forked&#124;
        if forked
          require &#039;ruby-debug-ide&#039;
          Debugger.cli_debug=true
          Debugger.start_server(nil,7000)
        end
    end
end</description>
		<content:encoded><![CDATA[<p>A couple of notes:</p>
<p>I&#8217;m not sure when the spawning code was added/changed in Passenger, but the code above will not work with Passenger 2.2.4. Putting the code to launch the debugger in environment.rb (or development.rb) means that it launches within the ApplicationSpawner process and the Rails requests are handled in separate worker processes so your breakpoints will never get hit.</p>
<p>Section 11.3 of the Passenger guide gives a technique for ensuring that you can hook the spawning of a new request handler. You&#8217;ll want to put the code outlined above in the &#8216;if forked&#8217; block. You will need a little extra code to preserve the state of debug.txt (whether it existed when Apache was tickled) and if your Passenger is configured to allow multiple workers (the default), you&#8217;ll have trouble identifying which listener is debugging which process</p>
<p><a href="http://www.modrails.com/documentation/Users%20guide.html#spawning_methods_explained" rel="nofollow">http://www.modrails.com/documentation/Users%20guide.html#spawning_methods_explained</a></p>
<p>Lastly, you can debug your Rails app from NetBeans by using the &#8216;ruby-debug-ide&#8217; gem instead of the &#8216;ruby-debug&#8217; gem.</p>
<p>Here&#8217;s my code in development.rb (it launches the debugger every time without regard to debug.txt)</p>
<p>if defined?(PhusionPassenger)<br />
    PhusionPassenger.on_event(:starting_worker_process) do |forked|<br />
        if forked<br />
          require &#8216;ruby-debug-ide&#8217;<br />
          Debugger.cli_debug=true<br />
          Debugger.start_server(nil,7000)<br />
        end<br />
    end<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FastJacks Paralleluniversum &#187; Passenger für Rails-3-Entwicklung</title>
		<link>http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger/comment-page-1#comment-105</link>
		<dc:creator>FastJacks Paralleluniversum &#187; Passenger für Rails-3-Entwicklung</dc:creator>
		<pubDate>Fri, 10 Sep 2010 12:19:05 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=17#comment-105</guid>
		<description>[...] für Rails-3-EntwicklungWie man den Phusion Passenger für die Entwicklung benutzt wurde schon an einigen Stellen beschrieben. In Verbindung mit Rails 3 gibt es eine kleine Falle. Folgt man diesen [...]</description>
		<content:encoded><![CDATA[<div style="background-color: #999999; color: #333333;">
<p>[...] für Rails-3-EntwicklungWie man den Phusion Passenger für die Entwicklung benutzt wurde schon an einigen Stellen beschrieben. In Verbindung mit Rails 3 gibt es eine kleine Falle. Folgt man diesen [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh P</title>
		<link>http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger/comment-page-1#comment-98</link>
		<dc:creator>Josh P</dc:creator>
		<pubDate>Thu, 18 Mar 2010 21:55:15 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=17#comment-98</guid>
		<description>Awesome. Thank you.</description>
		<content:encoded><![CDATA[<p>Awesome. Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bobbi</title>
		<link>http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger/comment-page-1#comment-97</link>
		<dc:creator>bobbi</dc:creator>
		<pubDate>Sat, 13 Mar 2010 14:16:36 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=17#comment-97</guid>
		<description>Is the a way to make this work with ruby 1.9 and the ruby-debug19 gem ?</description>
		<content:encoded><![CDATA[<p>Is the a way to make this work with ruby 1.9 and the ruby-debug19 gem ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: http://duckpunching.com/passenger-mod_ra&#8230; &#171; bst On Web Dev</title>
		<link>http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger/comment-page-1#comment-96</link>
		<dc:creator>http://duckpunching.com/passenger-mod_ra&#8230; &#171; bst On Web Dev</dc:creator>
		<pubDate>Wed, 17 Feb 2010 16:25:13 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=17#comment-96</guid>
		<description>[...] http://duckpunching.com/passenger-mod_ra&#8230; http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger [...]</description>
		<content:encoded><![CDATA[<div style="background-color: #999999; color: #333333;">
<p>[...] <a href="http://duckpunching.com/passenger-mod_ra&#038;#8230" rel="nofollow">http://duckpunching.com/passenger-mod_ra&#038;#8230</a>; <a href="http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger" rel="nofollow">http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger</a> [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: The World Is Just A&#8230; &#187; Debugging rails (in mongrel and passenger)</title>
		<link>http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger/comment-page-1#comment-95</link>
		<dc:creator>The World Is Just A&#8230; &#187; Debugging rails (in mongrel and passenger)</dc:creator>
		<pubDate>Thu, 24 Dec 2009 20:37:45 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=17#comment-95</guid>
		<description>[...] wait, there is hope: here is a great post on how to debug remotely using ruby-debug. The other option that i tried was using [...]</description>
		<content:encoded><![CDATA[<div style="background-color: #999999; color: #333333;">
<p>[...] wait, there is hope: here is a great post on how to debug remotely using ruby-debug. The other option that i tried was using [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: rails passenger development environment &#124; NoteIt!</title>
		<link>http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger/comment-page-1#comment-94</link>
		<dc:creator>rails passenger development environment &#124; NoteIt!</dc:creator>
		<pubDate>Wed, 16 Dec 2009 06:32:42 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=17#comment-94</guid>
		<description>[...] 下面比较一下二者： 1. 同时对多个本地app进行开发时，passenger比webrick好。因为不需要对于每个app都开一个webrick server，而且对于每个server还需要指定不同的port。 2. 在查看request的信息方面，passenger和webrick差不多。webrick是直接在terminal中显示每个request的信息;而在使用passenger时，则可以通过动态显示development.log的方式进行查看。 3. 在debug方面，webrick会比passenger方便些。在使用webrick时，只需要使用u option来启动server，那么app就会在运行时中断在程序中写有debugger语句的地方。可是，在使用passenger时，debug可能会比较麻烦。目前看到的有两种方式，一种是通过使用remote debug的方式，具体可以参考Passenger (mod_rails) for development. Now with debugger! 。另一种是使用rack-debug，它是一个ruby-debug的interface，其使用方式和webrick没有多大区别，但是唯一一点令我难受的时，对于每个rails app，都需要添加一个middleware来实现rack-debug的功能，但是由于可以通过version control在真正的app里过滤掉这些文件，其实并没有多大影响。 [...]</description>
		<content:encoded><![CDATA[<div style="background-color: #999999; color: #333333;">
<p>[...] 下面比较一下二者： 1. 同时对多个本地app进行开发时，passenger比webrick好。因为不需要对于每个app都开一个webrick server，而且对于每个server还需要指定不同的port。 2. 在查看request的信息方面，passenger和webrick差不多。webrick是直接在terminal中显示每个request的信息;而在使用passenger时，则可以通过动态显示development.log的方式进行查看。 3. 在debug方面，webrick会比passenger方便些。在使用webrick时，只需要使用u option来启动server，那么app就会在运行时中断在程序中写有debugger语句的地方。可是，在使用passenger时，debug可能会比较麻烦。目前看到的有两种方式，一种是通过使用remote debug的方式，具体可以参考Passenger (mod_rails) for development. Now with debugger! 。另一种是使用rack-debug，它是一个ruby-debug的interface，其使用方式和webrick没有多大区别，但是唯一一点令我难受的时，对于每个rails app，都需要添加一个middleware来实现rack-debug的功能，但是由于可以通过version control在真正的app里过滤掉这些文件，其实并没有多大影响。 [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: http://duckpunching.com/passenger-mod_ra&#8230; &#171; bst On Web Dev</title>
		<link>http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger/comment-page-1#comment-93</link>
		<dc:creator>http://duckpunching.com/passenger-mod_ra&#8230; &#171; bst On Web Dev</dc:creator>
		<pubDate>Mon, 19 Oct 2009 14:53:53 +0000</pubDate>
		<guid isPermaLink="false">http://duckpunching.com/?p=17#comment-93</guid>
		<description>[...]  2:55 pm on October 19, 2009  Reply   Tags: debugging, rails (69), tutorials (5)    http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger &#8211; Passenger (mod_rails) for development. Now with debugger!   [...]</description>
		<content:encoded><![CDATA[<div style="background-color: #999999; color: #333333;">
<p>[...]  2:55 pm on October 19, 2009  Reply   Tags: debugging, rails (69), tutorials (5)    <a href="http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger" rel="nofollow">http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger</a> &#8211; Passenger (mod_rails) for development. Now with debugger!   [...]</p>
</div>
]]></content:encoded>
	</item>
</channel>
</rss>

