Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (42 sloc) 2.45 KB
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="">
<title><![CDATA[Category: message | Entreprevelopment adventures]]></title>
<link href="" rel="self"/>
<link href=""/>
<name><![CDATA[Luisa Lima]]></name>
<generator uri="">Octopress</generator>
<title type="html"><![CDATA[Silencing nagging logs in rails]]></title>
<link href=""/>
<content type="html"><![CDATA[<p>Once upon a time, I was trying to do some meaningful debugging in rails with</p>
<pre><code> logger.debug </code></pre>
<p>and I was being particularly nagged by these annoying messages from Webrick:</p>
<pre><code> WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true [closed]
<p>The way to solve this? I am using 'thin' instead of Webrick as a development server (yeah, I know that there are <a href="">patches to solve this in Webrick</a> but I decided to go a bit aggressive instead).</p>
<p>And another thing that nagged me were the asset pipeline messages with the gets for the css, js, images, etc. So one way to shut Sprockets up is given <a href="">here</a>, and just for the record:</p>
<pre><code> # place this code in config/initializers/quiet_assets.rb
if Rails.env.development?
Rails.application.assets.logger ='/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
Rails.logger.level = previous_level
alias_method_chain :call, :quiet_assets
<p>Ahhhhh now I can actually see <strong>meaningful</strong> logs in my development log. <em>whew!</em></p>