Skip to content

Instantly share code, notes, and snippets.

@godfat
Created March 19, 2012 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save godfat/2108649 to your computer and use it in GitHub Desktop.
Save godfat/2108649 to your computer and use it in GitHub Desktop.
before_fork do |server, worker|
# dirty hack to shut up Rack::CommonLogger for assets
next unless ENV['RACK_ENV'] == 'development'
app = server.app
app = app.instance_variable_get(:@app) until
app.kind_of?(Rack::CommonLogger) ||
app.instance_variable_get(:@app).nil?
app.instance_eval{
@logger.puts "Silencing #{app.class} to #{IO::NULL}..."
@logger = File.open(IO::NULL, 'w')
} if app && IO.const_defined?(:NULL)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment