<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: log file code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 21 Aug 2008 00:43:44 GMT</pubDate>
    <description>DZone Snippets: log file code</description>
    <item>
      <title>truncate Rails development/test logs</title>
      <link>http://snippets.dzone.com/posts/show/4399</link>
      <description>In rails applications development.log and test.log like to grow forever, which takes up space and makes them slow to grep.  If I just delete them running processes with logs open might get confused.  So I can use truncate instead:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;truncate ~/www/*/log/*.log&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Even easier, ask cron to do it for me every night:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;4 22 * * * * truncate -s 0k  ~/www/*/log/*.log&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 07 Aug 2007 17:17:16 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4399</guid>
      <author>laurelfan (Laurel Fan)</author>
    </item>
  </channel>
</rss>
