php 之 日志系統seaslog安裝


php 之 日志系統seaslog


 

特點:

  1、高性能(使用C語言編寫的)。

  2、無需配置。

  3、功能完善、使用簡單。


安裝:

  打開php的擴展官網:https://pecl.php.net/

  然后搜索Seaslog,

  選擇最新的版本下載:

wget https://pecl.php.net/get/SeasLog-1.8.4.tgz

解壓:

tar zxvf SeasLog-1.8.4.tgz 

然后進入SeasLog目錄

cd SeasLog-1.8.4/

然后執行phpize:

關於什么是phpize,參考博客:https://blog.csdn.net/qq_16399991/article/details/70577740。

phpize

如果顯示命令未找到:

就先安裝php-dev:

sudo apt-get install php5-dev

下一步,執行configure:

./configure 

如果報錯,顯示命令未找到php-config,就需要添加自己的php路徑:

./configure -- with-php-config=/usr/local/php/bin/php-config

下一步:

sudo make && make install

如果提示目錄沒有權限,就修改指定目錄的權限。

安裝結果:

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:

進入目錄查看:

cd /usr/lib/php5/20121212/

可以看到:seaslog.so。

然后修改php.ini文件。

如果不知道php.ini文件在哪,可以通過phpinfo查看。

Nginx:

Loaded Configuration File /etc/php5/fpm/php.ini

apache:

Loaded Configuration File  /etc/php5/apache2

打開php.ini,增加一行:

extension = "seaslog.so"

然后重啟nginx服務或apache服務,再查看phpinfo,就可以看到安裝成功。

打開Seaslog的github:https://github.com/SeasX/SeasLog

找到Seaslog.ini,復制內容到php.ini中。

;configuration for php SeasLog module
extension = seaslog.so

;Default Log Base Path
seaslog.default_basepath = "/var/log/www"

;Default Logger Path
seaslog.default_logger = "default"

;The DateTime Style.  Default "Y-m-d H:i:s"
seaslog.default_datetime_format = "Y-m-d H:i:s"

;Default Log template. 
;Default "%T | %L | %P | %Q | %t | %M"
seaslog.default_template = "%T | %L | %P | %Q | %t | %M"

;Switch use the logger with folder. 
;1-Y(Default) 0-N
seaslog.disting_folder = 1

;Switch use the logger with type.
;1-Y 0-N(Default)
seaslog.disting_type = 0

;Switch use the logger with hour.
;1-Y 0-N(Default)
seaslog.disting_by_hour = 0

;Switch use the log buffer with memory.
;1-Y 0-N(Default)
seaslog.use_buffer = 0

;The buffer size
seaslog.buffer_size = 100

;disable buffer in cli
;1-Y 0-N(Default)
seaslog.buffer_disabled_in_cli = 0

;Record logger level. 
;0-EMERGENCY 1-ALERT 2-CRITICAL 3-ERROR 4-WARNING 5-NOTICE 6-INFO 7-DEBUG 8-ALL
;Default 8 (All of them).
;
;   Tips: The configuration item has changed since the 1.7.0 version.
;   Before the 1.7.0 version, the smaller the value, the more logs are taken according to the level: 
;   0-all 1-debug 2-info 3-notice 4-warning 5-error 6-critical 7-alert 8-emergency
;   Before the 1.7.0 version, Default 0 (All of them).
seaslog.level = 8

;Log function recall depth
;Will affected variable `LineNo` in `%F`
;Default 0
seaslog.recall_depth = 0

;Automatic Record notice with default logger
;1-Y 0-N(Default)
seaslog.trace_notice = 0

;Automatic Record warning with default logger
;1-Y 0-N(Default)
seaslog.trace_warning = 0

;Automatic Record final error with default logger. 
;1-Y(Default) 0-N
seaslog.trace_error = 1

;Automatic Record exception with default logger. 
;1-Y 0-N(Default)
seaslog.trace_exception = 0

;Switch the Record Log Data Store.     
;1File 2TCP 3UDP (Switch default 1)
seaslog.appender = 1

;Record Log Retry Count 
;Default 0 (Do Not Retry)
seaslog.appender_retry = 0

;If you use  Record TCP or UDP, configure this remote ip.
;Default "127.0.0.1"
seaslog.remote_host = "127.0.0.1"

;If you use Record TCP or UDP, configure this remote port.
;Default 514
seaslog.remote_port = 514

;If you use Record TCP or UDP, configure this remote timeout.
;Default 1 second
seaslog.remote_timeout = 1

;Trim the \n and \r in log message.
;1-On 0-Off(Default)
seaslog.trim_wrap = 0

;Switch throw SeasLog exception.
;1-On(Default) 0-Off
seaslog.throw_exception = 1

;Switch ignore SeasLog warning.
;1-On(Default) 0-Off
seaslog.ignore_warning = 1

 


 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM