php開啟慢日誌

來源:互聯網
上載者:User

標籤: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 setslowlog = 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: 0request_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 2957script_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 2968script_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開啟慢日誌

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.