ThinkPHP 3.2 日志出不来的原因是TP自各儿的BUG

WBOY
リリース: 2016-06-13 12:12:36
オリジナル
2370 人が閲覧しました

ThinkPHP 3.2 日志出不来的原因是TP自己的BUG

?

?

?

?

3

.2.2Think\Log\Driver\File 日志文件记录BUG

?
浏览:237?发布日期:2014/08/31?分类:技术分享 关键字:?日志
  1. ????public?function?write($log,$destination='')?{
  2. ????????$now?=?date($this->config['log_time_format']);
  3. ????????if(empty($destination))
  4. ????????????$destination?=?$this->config['log_path'].date('y_m_d').'.log';
  5. ????????if(!is_dir($this->config['log_path']))?{
  6. ????????????mkdir($this->config['log_path'],0755,true);
  7. ????????}????????
  8. ????????//检测日志文件大小,超过配置大小则备份日志文件重新生成
  9. ????????if(is_file($destination)?&&?floor($this->config['log_file_size'])??filesize($destination)?)
  10. ??????????????rename($destination,dirname($destination).'/'.time().'-'.basename($destination));
  11. ????????error_log("[{$now}]?".$_SERVER['REMOTE_ADDR'].'?'.$_SERVER['REQUEST_URI']."\r\n{$log}\r\n",?3,$destination);
  12. ????}
复制代码修改为:
  1. ????public?function?write($log,$destination='')?{
  2. ????????$now?=?date($this->config['log_time_format']);
  3. ????????if(empty($destination))
  4. ????????????$destination?=?$this->config['log_path'].date('y_m_d').'.log';
  5. ????????????????if($destination) ? ? ?
  6. ????????????$this->config['log_path']?=?dirname($destination);
  7. ????????if(!is_dir($this->config['log_path']))?{
  8. ????????????mkdir($this->config['log_path'],0755,true);
  9. ????????}????????
  10. ????????//检测日志文件大小,超过配置大小则备份日志文件重新生成
  11. ????????if(is_file($destination)?&&?floor($this->config['log_file_size'])??filesize($destination)?)
  12. ??????????????rename($destination,dirname($destination).'/'.time().'-'.basename($destination));
  13. ????????error_log("[{$now}]?".$_SERVER['REMOTE_ADDR'].'?'.$_SERVER['REQUEST_URI']."\r\n{$log}\r\n",?3,$destination);
  14. ????}

?

ThinkPHP的Ajax没办法页面Trace。但是一直日志都出不来。到TP的论坛上搜了一下,原来是自身的BUG,然后按照提示修改来了,日志就出来了。

関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!