PHP日志

WBOY
WBOYOriginal
2016-06-23 13:29:001077browse



$des = './Application/Runtime/Logs/Api/api.log';
// $now = date('c');
$now = date('Y-m-d H:i:s');
$log = 'NOTICE';
$destination = 'DB连接失败';
error_log("[{$now}] ".$destination.' '.$_SERVER['REMOTE_ADDR'].' '.$_SERVER['REQUEST_URI']."\r\n{$log}\r\n",3,$des);


返回写入的结果:

[2015-08-10 19:30:17] DB连接失败127.0.0.1 /branches/v2.0.0/api/feed/getall?temp_token=1&contactUid=
NOTICE
[2015-08-10 19:30:41] DB连接失败 127.0.0.1 /branches/v2.0.0/api/feed/getall?temp_token=1&contactUid=
NOTICE


可以参考:

ThinkPHP/log/Driver/File.class.php     可以参考一下文件




版权声明:本文为博主原创文章,未经博主允许不得转载。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn