首页 > PHP资讯 > PHP培训技术 > PHP日志扩展 SeasLog

PHP日志扩展 SeasLog

PHP培训技术

使用SeasLog进行健康预警

预警的配置

[base]wait_analyz_log_path = /log/base_test[fork];是否开启多线程 1开启 0关闭fork_open = 1;线程个数fork_count = 3[warning]email[smtp_host] = smtp.163.comemail[smtp_port] = 25email[subject_pre] = 预警邮件 -email[smtp_user] = seaslogdemo@163.comemail[smtp_pwd] = seaslog#demoemail[mail_from] = seaslogdemo@163.comemail[mail_to] = gaochitao@weiboyi.comemail[mail_cc] = ciogao@gmail.comemail[mail_bcc] =[analyz]; enum; SEASLOG_DEBUG      "debug"; SEASLOG_INFO       "info"; SEASLOG_NOTICE     "notice"; SEASLOG_WARNING    "warning"; SEASLOG_ERROR      "error"; SEASLOG_CRITICAL   "critical"; SEASLOG_ALERT      "alert"; SEASLOG_EMERGENCY  "emergency"test1[module] = test/bbtest1[level] = SEASLOG_ERRORtest1[bar] = 1test1[mail_to] = gaochitao@weiboyi.comtest2[module] = 222test2[level] = SEASLOG_WARNINGtest3[module] = 333test3[level] = SEASLOG_CRITICALtest4[module] = 444test4[level] = SEASLOG_EMERGENCYtest5[module] = 555test5[level] = SEASLOG_DEBUG


crontab配置

;每天凌晨3点执行0 3 * * * /path/to/php /path/to/SeasLog/Analyzer/SeasLogAnalyzer.php


Demo:

<?php/** * @author ciogao@gmail.com * Date: 14-1-27 下午4:41 */  SeasLog::log(SEASLOG_ERROR,'this is a error test by ::log');SeasLog::debug('this is a {userName} debug',array('{userName}' => 'neeke'));SeasLog::info('this is a info log');SeasLog::notice('this is a notice log');SeasLog::warning('your {website} was down,please {action} it ASAP!',array('{website}' => 'github.com','{action}' => 'rboot'));SeasLog::error('a error log');SeasLog::critical('some thing was critical');SeasLog::alert('yes this is a {messageName}',array('{messageName}' => 'alertMSG'));SeasLog::emergency('Just now, the house next door was completely burnt out! {note}',array('{note}' => 'it`s a joke'));echo "n";



本文由欣才IT学院整理发布,未经许可,禁止转载。