saw*_*awa 7 ruby logging rack thin
如何阻止Rack Thin返回以下类型的初始消息?
>>瘦Web服务器(v1.3.1代号为Triple Espresso)
>>最大连接数设置为1024
>>在0.0.0.0:3000上加速,CTRL + C停止
我这样使用它:
Rack::Handler::Thin.run(Rack::Builder.new do
map("/resource/"){run(Rack::File.new("/"))}
map("/") do
run(->env{
h = Rack::Utils.parse_nested_query(env["QUERY_STRING"])
[200, {},[routine_to_generate_dynamic_content(h)]]
})
end
end, Port: 3000)
Run Code Online (Sandbox Code Playgroud)
这些消息不是来自机架,而是来自 Thin: https: //github.com/macournoyer/thin/blob/master/lib/thin/server.rb#L150您可以根据以下内容设置日志记录首选项:https: //github.com/macournoyer/thin/blob/master/lib/thin/logging.rb Thin::Logging.silent = true,但是你真的想让所有人都沉默吗?也许将其定向到日志文件而不是标准输出?