[Mapbender-commits] r1827 - in trunk/mapbender/http: classes tools
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Nov 23 06:31:16 EST 2007
Author: christoph
Date: 2007-11-23 06:31:03 -0500 (Fri, 23 Nov 2007)
New Revision: 1827
Modified:
trunk/mapbender/http/classes/class_mb_exception.php
trunk/mapbender/http/tools/mapbender_setup.php
Log:
check if error logging works by logging a test message
Modified: trunk/mapbender/http/classes/class_mb_exception.php
===================================================================
--- trunk/mapbender/http/classes/class_mb_exception.php 2007-11-23 10:40:54 UTC (rev 1826)
+++ trunk/mapbender/http/classes/class_mb_exception.php 2007-11-23 11:31:03 UTC (rev 1827)
@@ -29,6 +29,8 @@
var $mb_log_level = LOG_LEVEL;
var $dir = "../../log/";
var $filename_prefix = "mb_error_";
+ var $result = false;
+ var $message = "";
function indexOf($level, $levelArray) {
$index = false;
@@ -57,12 +59,32 @@
if($h = fopen($logfile,"a")){
$content = date("Y.m.d, H:i:s") . "," . $n .chr(13).chr(10);
if(!fwrite($h,$content)){
- #exit;
+ $this->result = false;
+ $this->message = "Unable to write " . $logfile;
+ return false;
}
fclose($h);
+ $this->result = true;
+ $this->message = "Successful.";
+ return true;
}
+ else {
+ $this->result = false;
+ $this->message = "Unable to open or generate " . $logfile;
+ return false;
+ }
}
+ else {
+ $this->result = false;
+ $this->message = "Directory " . $this->dir . " is not valid.";
+ return false;
+ }
}
+ else {
+ $this->result = false;
+ $this->message = "Log level '" . $level . "' is not valid or logging is disabled in mapbender.conf.";
+ return false;
+ }
}
}
@@ -70,7 +92,7 @@
var $level = "notice";
function mb_notice($message) {
- $this->mb_log("Notice: " . $message, $this->level);
+ return $this->mb_log("Notice: " . $message, $this->level);
}
}
@@ -78,7 +100,7 @@
var $level = "warning";
function mb_warning($message) {
- $this->mb_log("Warning: " . $message, $this->level);
+ return $this->mb_log("Warning: " . $message, $this->level);
}
}
@@ -86,7 +108,7 @@
var $level = "error";
function mb_exception($message) {
- $this->mb_log("ERROR: " . $message, $this->level);
+ return $this->mb_log("ERROR: " . $message, $this->level);
}
}
?>
\ No newline at end of file
Modified: trunk/mapbender/http/tools/mapbender_setup.php
===================================================================
--- trunk/mapbender/http/tools/mapbender_setup.php 2007-11-23 10:40:54 UTC (rev 1826)
+++ trunk/mapbender/http/tools/mapbender_setup.php 2007-11-23 11:31:03 UTC (rev 1827)
@@ -21,7 +21,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+include_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
@@ -251,6 +252,14 @@
else $check .="<tr><td>AUTO_UPDATE</td><td></td><td><font color=#FF0000>set to " . AUTO_UPDATE . ": this configuration value is not supported(as yet!)</td></tr>";
}
else $check .="<tr><td>AUTO_UPDATE</td><td></td><td><font color=#FF0000>AUTO_UPDATE not defined </font><font color=#0000FF>(for the wms monitoring functionality you have to define this constant)</font></td></tr>";
+# ERROR LOGGING
+ $testLog = new mb_notice("This is a test run by the Mapbender setup script.");
+ if ($testLog->result) {
+ $check .="<tr><td>ERROR LOGGING</td><td>X</td><td><font color=#00D000>" . $testLog->message . "</font></td></tr>";
+ }
+ else {
+ $check .="<tr><td>ERROR LOGGING</td><td></td><td><font color=#FF0000>" . $testLog->message . "</font></td></tr>";
+ }
#LOG_LEVEL (off,error,warning,all)
if (LOG_LEVEL !="" && defined('LOG_LEVEL')){
if (LOG_LEVEL =='off') $check .="<tr><td>LOG_LEVEL</td><td>X</td><td>switched off: <font color=#FF0000>-no Mapbender-errors logging</font><td></tr>";
More information about the Mapbender_commits
mailing list