Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: a83b7afcb0
Fetching contributors…

Cannot retrieve contributors at this time

58 lines (42 sloc) 2.51 kb
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Category: message | Entreprevelopment adventures]]></title>
<link href="http://luisalima.github.com/blog/categories/message/atom.xml" rel="self"/>
<link href="http://luisalima.github.com/"/>
<updated>2012-12-19T19:57:09+00:00</updated>
<id>http://luisalima.github.com/</id>
<author>
<name><![CDATA[Luisa Lima]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Silencing nagging logs in rails]]></title>
<link href="http://luisalima.github.com/blog/2012/12/13/disabling-nagging-logs-in-rails/"/>
<updated>2012-12-13T10:20:00+00:00</updated>
<id>http://luisalima.github.com/blog/2012/12/13/disabling-nagging-logs-in-rails</id>
<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]
</code></pre>
<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="https://bugs.ruby-lang.org/attachments/2300/204_304_keep_alive.patch">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="http://stackoverflow.com/questions/6312448/how-to-disable-logging-of-asset-pipeline-sprockets-messages-in-rails-3-1">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 = Logger.new('/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/}
call_without_quiet_assets(env)
ensure
Rails.logger.level = previous_level
end
alias_method_chain :call, :quiet_assets
end
end
</code></pre>
<p>Ahhhhh now I can actually see <strong>meaningful</strong> logs in my development log. <em>whew!</em></p>
]]></content>
</entry>
</feed>
Jump to Line
Something went wrong with that request. Please try again.