我试图捕获有关某个laravel响应的问题,所以我使用后过滤器来记录所有活动,但我无法弄清楚如何将请求和响应信息转储到日志中.
App::after(
function ($request, $response) {
Log::info('access.log', array('request' => $request->headers, 'response' => $response->headers));
}
);
Run Code Online (Sandbox Code Playgroud)
这段代码没有给出响应的状态代码信息,我最感兴趣.
有没有办法看到在将信息传递到Web服务器的最后阶段出现了什么?像这样的东西?
HTTP/1.1 200 OK
Date: Tue, 25 Nov 2014 22:35:17 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.4.34-1+deb.sury.org~lucid+1
Cache-Control: no-cache, max-age=0
Expires: Tue, 25 Nov 2014 22:35:17 GMT
Content-Type: application/json
Via: 1.1 localhost:8080
Vary: Accept-Encoding
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Length: 59
{"success":true,"result":{"min":5.7,"mean":9.7,"max":14.2}}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6693 次 |
| 最近记录: |