Commit 50da8839 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-682 "filelog" and "syslog" classes can not be found by autoloader

(because they are in camel case and not lowercase). Rewriting the
backend loaded by ZLog to the class name, as this is more end-user
friendly.
Throwing a FatalNotImplementedException causes a recursion that eats up
all available memory before it fails, as that exception tries to log
which then throws the exception again.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 12566e80
......@@ -161,9 +161,12 @@ class ZLog {
static private function getLogger() {
if (!self::$logger) {
global $specialLogUsers; // This variable comes from the configuration file (config.php)
$logger = LOGBACKEND;
$logger = LOGBACKEND_CLASS;
if (!class_exists($logger)) {
throw new FatalNotImplementedException('The logging class `'.$logger.'` does not exist.');
$errmsg = 'The configured logging class `'.$logger.'` does not exist. Check your configuration.';
error_log($errmsg);
throw new \Exception($errmsg);
}
list($user) = Utils::SplitDomainUser(strtolower(Request::GetGETUser()));
......
......@@ -225,7 +225,7 @@ class ZPush {
}
if (LOGBACKEND == 'syslog') {
define('LOGBACKEND_CLASS', 'Syslog');
if (!defined('LOG_SYSLOG_FACILITY')) {
define('LOG_SYSLOG_FACILITY', LOG_LOCAL0);
}
......@@ -251,7 +251,7 @@ class ZPush {
}
}
elseif (LOGBACKEND == 'filelog') {
define('LOGBACKEND_CLASS', 'FileLog');
if (!defined('LOGFILEDIR'))
throw new FatalMisconfigurationException("The LOGFILEDIR is not configured. Check if the config.php file is in place.");
......@@ -271,6 +271,9 @@ class ZPush {
Utils::FixFileOwner(LOGFILE);
Utils::FixFileOwner(LOGERRORFILE);
}
else {
define('LOGBACKEND_CLASS', LOGBACKEND);
}
// set time zone
// code contributed by Robert Scheck (rsc)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment