From 827e53c7f66753cf24899f24d3f947169a37c7b2 Mon Sep 17 00:00:00 2001 From: huangdijia Date: Tue, 26 May 2015 08:55:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=8D=E5=8A=A1=E5=99=A8IP?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=EF=BC=8C=E6=94=AF=E6=8C=81=E5=88=86=E6=AD=A5?= =?UTF-8?q?=E5=BC=8F=E9=83=A8=E7=BD=B2=E6=97=A5=E5=BF=97=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/log/driver/file.php | 2 +- library/think/log/driver/sae.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/think/log/driver/file.php b/library/think/log/driver/file.php index 1231d72c..d2711da2 100644 --- a/library/think/log/driver/file.php +++ b/library/think/log/driver/file.php @@ -38,6 +38,6 @@ class File { //检测日志文件大小,超过配置大小则备份日志文件重新生成 if(is_file($destination) && floor($this->config['file_size']) <= filesize($destination) ) rename($destination,dirname($destination).'/'.time().'-'.basename($destination)); - error_log("[{$now}] ".$_SERVER['REMOTE_ADDR'].' '.$_SERVER['REQUEST_URI']."\r\n{$log}\r\n", 3,$destination); + error_log("[{$now}] {$_SERVER['SERVER_ADDR']} {$_SERVER['REMOTE_ADDR']} {$_SERVER['REQUEST_URI']}\r\n{$log}\r\n", 3,$destination); } } diff --git a/library/think/log/driver/sae.php b/library/think/log/driver/sae.php index 78ae8b91..7392aa10 100644 --- a/library/think/log/driver/sae.php +++ b/library/think/log/driver/sae.php @@ -32,7 +32,7 @@ class Sae { public function write($log,$destination='') { static $is_debug = null; $now = date($this->config['log_time_format']); - $logstr = "[{$now}] ".$_SERVER['REMOTE_ADDR'].' '.$_SERVER['REQUEST_URI']."\r\n{$log}\r\n"; + $logstr = "[{$now}] {$_SERVER['SERVER_ADDR']} {$_SERVER['REMOTE_ADDR']} {$_SERVER['REQUEST_URI']}\r\n{$log}\r\n"; if(is_null($is_debug)){ preg_replace('@(\w+)\=([^;]*)@e', '$appSettings[\'\\1\']="\\2";', $_SERVER['HTTP_APPCOOKIE']); $is_debug = in_array($_SERVER['HTTP_APPVERSION'], explode(',', $appSettings['debug'])) ? true : false;