码迷,mamicode.com
首页 > Web开发 > 详细

php开启慢日志

时间:2014-09-19 13:35:55      阅读:298      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   for   文件   2014   div   sp   代码   

默认是以本机的安装路径

cd /usr/local/php/etc/

vim php-fpm.conf

; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
slowlog = log/pool.log.slow   //可以修改慢日志的路径

; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the ‘slowlog‘ file. A value of ‘0s‘ means ‘off‘.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
request_slowlog_timeout = 1   //慢日志超时的时间

不过目录需要手动创建,不然重启php-fpm将会出错

mkdir /usr/local/php/log

 

php-fpm慢日志的例子,慢日志会记录下进程号,脚本名称,具体哪个文件哪行代码的哪个函数执行时间过长。

 

查看慢日志文件  tail -10f  pool.log.show

[19-Sep-2014 11:34:12]  [pool www] pid 2957
script_filename = /data/wwwroot/cms.91.com/webroot/mobile91.php
[0x00000000030c6c10] request_by_curl() /data/wwwroot/cms.91.com/webroot/mobile91.php:207
[0x00000000030c6190] request_by_curl() /data/wwwroot/cms.91.com/webroot/mobile91.php:189

[19-Sep-2014 11:34:47]  [pool www] pid 2968
script_filename = /data/wwwroot/cms.91.com/webroot/mobile91.php
[0x000000000300b840] request_by_curl() /data/wwwroot/cms.91.com/webroot/mobile91.php:206
[0x000000000300adc0] request_by_curl() /data/wwwroot/cms.91.com/webroot/mobile91.php:189

 

 



php开启慢日志

标签:style   blog   color   for   文件   2014   div   sp   代码   

原文地址:http://www.cnblogs.com/agang-php/p/3981148.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!