Skip to content

Instantly share code, notes, and snippets.

@godfat godfat/unicorn.rb
Created Mar 19, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.