<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>threehv &#187; deployment</title>
	<atom:link href="http://www.3hv.co.uk/blog/tag/deployment/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.3hv.co.uk/blog</link>
	<description>precision engineering for your website</description>
	<lastBuildDate>Fri, 13 Jan 2012 16:18:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>My cron jobs and rake tasks won&#8217;t write to the Rails log file</title>
		<link>http://www.3hv.co.uk/blog/2009/06/01/my-cron-jobs-and-rake-tasks-wont-write-to-the-rails-log-file/</link>
		<comments>http://www.3hv.co.uk/blog/2009/06/01/my-cron-jobs-and-rake-tasks-wont-write-to-the-rails-log-file/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 21:34:09 +0000</pubDate>
		<dc:creator>Rahoul Baruah</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Ruby on Rails and Software Development]]></category>
		<category><![CDATA[clusters]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[logger]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.3hv.co.uk/blog/?p=542</guid>
		<description><![CDATA[A project I&#8217;ve been working on was recently moved up to Rails 2.2 (Rails 2.3 migration coming soon, but we wanted to take things one step at a time). All the tests passed. Poking it on the staging server worked well. On to production and all was good. Time passed. Then, the app needed to [...]]]></description>
			<content:encoded><![CDATA[<p>A project I&#8217;ve been working on was recently moved up to Rails 2.2 (Rails 2.3 migration coming soon, but we wanted to take things one step at a time).  </p>
<p>All the tests passed.  Poking it on the staging server worked well.  On to production and all was good.  </p>
<p>Time passed.  </p>
<p>Then, the app needed to be moved to a new server.  Actually to a cluster.  Slightly more nerve-wracking, but some playing around with the <a href="http://github.com/bjeanes/ghost/tree/master">ghost</a> gem and DNS settings and the deployment completed.  </p>
<p>More time passed.  </p>
<p>And then disaster struck.  Well, not disaster, but it wasn&#8217;t good.  Not at all.   </p>
<p>The app had a rake task that was cronned to run every night.  And it failed silently.  We found out the day after and I scanned the production log file looking for evidence of what went wrong.  Nowt.  It didn&#8217;t even look like the rake task had run &#8211; but it had, as I had the data in front of me.  </p>
<p>And the day after, it failed again.  Another scan of the production log revealed nothing.  Things were getting serious.  </p>
<p>I suspected the cluster deployment.  Maybe cron didn&#8217;t have permission to write to the log file, even though Passenger did.  But everything looked good on that front.  Maybe there was something else weird about the cluster setup &#8211; all the cron jobs were set to run on one of the app-servers; maybe moving it would make a difference?  </p>
<p>To test this, I opened the Rails console and started manually recreating what the rake task was doing, on a different app-server.  Which is when I noticed that script/console wasn&#8217;t writing to the production log either.  What?  </p>
<p>After a couple of hours of head scratching, I finally found out that the cluster deployment was not at fault.  In fact, it seems to be the move to Rails 2.2 that had happened many weeks before &#8211; in particular it appears that the logger object no longer auto-flushes itself after writing.  </p>
<p>We added a quick <code>Rails.logger.auto_flushing = 1</code> to an initialiser and both script/console and the rake tasks wrote to the log as expected.  Phew!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.3hv.co.uk/blog/2009/06/01/my-cron-jobs-and-rake-tasks-wont-write-to-the-rails-log-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.221 seconds -->

