php seaslog的使用

來源:互聯網
上載者:User

標籤:Tlog   echo   自動   master   exception   install   tps   buffer   今天   

今天有幸在慕課網看到了 關於phpTlog工具  seasLog 的使用視頻,本著好奇看完了該視頻,覺得不錯,便自己也倒騰了下,現在整理出來

seaslog github: https://github.com/Neeke/SeasLog/blob/master/README_zh.md 這個文章告訴我們咋用,用哪些函數,哪些常量

接下來說下配置:

 

1.安裝

  

pecl install seaslog

2.配置

[seaslog]seaslog.default_basepath = /home/www/log/               ;預設log根目錄seaslog.default_logger = seaslog                        ;預設logger目錄seaslog.disting_type = 0                                ;是否以type分檔案 1是 0>否(預設)seaslog.disting_by_hour = 0                             ;是否每小時劃分一個檔案 1是 0否(預設)seaslog.use_buffer = 1                                  ;是否啟用buffer 1是 0否(預設)seaslog.buffer_size = 500                               ;buffer中緩衝數量 預設0(不使用buffer_size)seaslog.level = 0                                       ;記錄記錄層級 預設0(所有日誌)seaslog.trace_error = 1                                 ;自動記錄錯誤 預設1(開啟)seaslog.trace_exception = 0                             ;自動記錄異常資訊 預設0(關閉)seaslog.default_datetime_format = "Y:m:d H:i:s"         ;日期格式配置 預設"Y:m:d H:i:s"seaslog.appender = 1                                    ;日誌儲存介質 1File 2TCP 3UDP (預設為1)seaslog.remote_host = 127.0.0.1                         ;接收ip 預設127.0.0.1 (>當使用TCP或UDP時必填)seaslog.remote_port = 514                               ;接收埠 預設514 (當使>用TCP或UDP時必填)seaslog.trim_wrap = 0                                   ;過濾日誌中的斷行符號和換行>符 (預設為0)

  

3.使用案例

function testSeaslog()    {        echo $start = time();        echo ‘<br>‘;        for($i = 0; $i < 10000; $i++) {            SeasLog::debug(‘this debug‘);              SeasLog::info(‘this info, hello zeopean‘);        }        echo $end = time();        echo ‘<br>‘;        echo $end - $start;        var_dump(\SeasLog::analyzerDetail(‘all‘, ‘*‘, ‘zeopean‘));    }

 

 

php seaslog的使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.