From: Sarah Hoffmann Date: Sun, 4 Mar 2012 11:50:45 +0000 (+0100) Subject: configurable file logging X-Git-Tag: v2.0.0~108 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/0005dc0a0fbed975cd9202f7f118b2997632a4f1?hp=--cc configurable file logging Respect CONST_Log_File setting and add two new configuration variables CONST_Log_File_SearchLog and CONST_Log_File_ReverseLog for the log file names. --- 0005dc0a0fbed975cd9202f7f118b2997632a4f1 diff --git a/lib/log.php b/lib/log.php index 8b5f00fd..93ad8f95 100644 --- a/lib/log.php +++ b/lib/log.php @@ -26,10 +26,11 @@ $oDB->query($sSQL); } + if (CONST_Log_File && CONST_Log_File_ReverseLog != '') { if ($sType == 'reverse') { $aStartTime = explode('.',$hLog[0]); - file_put_contents('/data/mapquest/opentile_http/logs/nominatimreverse', + file_put_contents(CONST_Log_File_ReverseLog, $aStartTime[0].','.$aStartTime[1].','. php_uname('n').','. '"'.addslashes(isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'').'",'. @@ -41,7 +42,7 @@ '"'.addslashes($_GET['format']).'"'."\n", FILE_APPEND); } - + } return $hLog; } @@ -67,8 +68,9 @@ $oDB->query($sSQL); } + if (CONST_Log_File && CONST_Log_File_SearchLog != '') { $aStartTime = explode('.',$hLog[0]); - file_put_contents('/data/mapquest/opentile_http/logs/nominatimsearch', + file_put_contents(CONST_Log_File_SearchLog, $aStartTime[0].','.$aStartTime[1].','. php_uname('n').','. '"'.addslashes(isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:'').'",'. @@ -78,5 +80,6 @@ '"'.addslashes($_GET['format']).'",'. $iNumResults."\n", FILE_APPEND); + } } diff --git a/settings/settings.php b/settings/settings.php index 3493a34a..591af1c6 100644 --- a/settings/settings.php +++ b/settings/settings.php @@ -34,3 +34,5 @@ @define('CONST_Log_DB', true); @define('CONST_Log_File', false); @define('CONST_Log_File_Format', 'TODO'); // Currently hard coded + @define('CONST_Log_File_SearchLog', ''); + @define('CONST_Log_File_ReverseLog', '');