如何让Unicorn在开发日志中显示帖子参数?

时间:2012-01-18 03:35:46

标签: ruby-on-rails ruby logging webserver unicorn

我刚刚开始尝试使用Unicorn(超薄),到目前为止,我确实喜欢输出的格式,除了它似乎没有显示各种请求的post参数。我真的很喜欢这个功能来帮助调试表单等....

独角兽:

20:26:14 web.1     | 127.0.0.1 - - [17/Jan/2012 20:26:14] "POST /basic_simulations HTTP/1.1" 422 24259 0.4838

我想要的......(这是来自webrick):

Started POST "/basic_simulations" for 127.0.0.1 at 2012-01-17 20:27:22 -0700
Processing by BasicSimulationsController#create as HTML
Parameters: {"utf8"=>"✓",
"authenticity_token"=>"xxxxx", "basic_simulation"=>{"x1706"=>"1"}, "commit"=>"Submit my answers"}

是否有一些配置选项或类似的东西,我可以打开此功能?谢谢!

4 个答案:

答案 0 :(得分:6)

更新:

将其添加到config / application.rb文件中:

config.logger = Logger.new(STDOUT)

更多信息here

答案 1 :(得分:2)

将其添加到 config / environments / development.rb 文件中:

config.logger = Logger.new(STDOUT)

更多信息here

答案 2 :(得分:0)

在您的网站配置中尝试此操作:

log_format postdata $request_body;
access_log  /var/log/nginx/postdata.log  postdata;

此处有更多信息:Logging POST data from $request_body

答案 3 :(得分:-2)

如果您正在将Foreman与proc文件一起使用,则可以将此行添加到Procfile:

 devlog: tail -f log/development.log

它会将开发日志放到终端窗口,就像webrick。