php 日志处理工具 SeasLog 的使用
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php 日志处理工具 SeasLog 的使用,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3748字,纯文字阅读大概需要6分钟。
内容图文
![php 日志处理工具 SeasLog 的使用](/upload/InfoBanner/zyjiaocheng/717/f9e0a39bfd6444b390c4814d8c17e0fe.jpg)
首先附上seaslog github地址:
https://github.com/Neeke/SeasLog/blob/master/README_zh.md
php官方文档地址:
https://www.php.net/manual/zh/class.seaslog.php
SeasLog是一个C语言编写的PHP扩展,提供一组规范标准的功能函数,在PHP项目中方便、规范、高效地写日志,以及快速地读取和查询日志。
一.什么是日志系统
1. 记录系统运行时的信息
2. 系统日志、应用程序日志、安全日志
3. 日志功能不应该影响到用户的正常使用
二.为什么需要日志功能
1. 了解系统运行情况
2. 记录用户操作信息
3. 收集数据
三.为什么选择SeasLog
1. 高性能(C语言做的 先将日志写入内存达到一定量再写入文件比频繁写入文件好)。
2. 无需配置
3. 功能完善、
4. 使用简单
四.安装SeasLog
pecl install seaslog
五.配置SeasLog
通过修改php.ini,修改seaslog配置
[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)
六.使用
SeasLog { /* 方法 */ public static alert ( string $message [, array $content [, string $logger ]] ) : bool public static analyzerCount ( string $level [, string $log_path [, string $key_word ]] ) : mixed public static analyzerDetail ( string $level [, string $log_path [, string $key_word [, int $start [, int $limit [, int $order ]]]]] ) : mixed public static closeLoggerStream ( int $model , string $logger ) : bool public static critical ( string $message [, array $content [, string $logger ]] ) : bool public static debug ( string $message [, array $content [, string $logger ]] ) : bool public __destruct ( void ) public static emergency ( string $message [, array $content [, string $logger ]] ) : bool public static error ( string $message [, array $content [, string $logger ]] ) : bool public static flushBuffer ( void ) : bool public static Seaslog::getBasePath ( void ) : string public static getBuffer ( void ) : array public static getBufferEnabled ( void ) : bool public static getDatetimeFormat ( void ) : string public static getLastLogger ( void ) : string public static getRequestID ( void ) : string public static getRequestVariable ( int $key ) : bool public static info ( string $message [, array $content [, string $logger ]] ) : bool public static log ( string $level [, string $message [, array $content [, string $logger ]]] ) : bool public static notice ( string $message [, array $content [, string $logger ]] ) : bool public static setBasePath ( string $base_path ) : bool public static setDatetimeFormat ( string $format ) : bool public static setLogger ( string $logger ) : bool public static setRequestID ( string $request_id ) : bool public static setRequestVariable ( int $key , string $value ) : bool public static warning ( string $message [, array $content [, string $logger ]] ) : bool }
内容总结
以上是互联网集市为您收集整理的php 日志处理工具 SeasLog 的使用全部内容,希望文章能够帮你解决php 日志处理工具 SeasLog 的使用所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。