2014-05-21, 04:26 PM
I need to be able to log the mybb forum errors in a log file. In the Admin Configuration section "Server and Optimization Options" the "Use Error Handling" is on, and I set the "Error Logging Medium" to "Log and email errors", "Error Type Medium" to "Warnings and Errors", "Error Logging Location" is "./error.log".
In the file system, I created the file error.log in the main folder mybb/ and chmod the file to 777.
Then I tried to give a wrong database name in mybb/inc/config.php, when I browsed the forum I got the error message displayed on the site, but I didn't get the e-mail notification and the log file was also empty.
Is there anything that I'm missing? My mybb version is 1.6.10.
Thanks very much,
Aiping
Found the reason. In the class_error.php, the $mybb->settings['errorlogmedium'] returns empty string. And that's why that log_error() didn't get triggered. But why $mybb->settings['errorlogmedium'] returns empty?
In settings.php,
$settings['errorlogmedium'] = "both";
Thanks!
Tried to print out the $mybb->array content, added the code in the file inc/class_error.php,
function error($type, $message, $file=null, $line=0)
{
global $mybb;
// testing code added here
echo "<pre>";
print_r($mybb->settings);
echo "</pre>";
...
}
It turns out the $mybb->settings is an empty array.
In the file system, I created the file error.log in the main folder mybb/ and chmod the file to 777.
Then I tried to give a wrong database name in mybb/inc/config.php, when I browsed the forum I got the error message displayed on the site, but I didn't get the e-mail notification and the log file was also empty.
Is there anything that I'm missing? My mybb version is 1.6.10.
Thanks very much,
Aiping
Found the reason. In the class_error.php, the $mybb->settings['errorlogmedium'] returns empty string. And that's why that log_error() didn't get triggered. But why $mybb->settings['errorlogmedium'] returns empty?
In settings.php,
$settings['errorlogmedium'] = "both";
Thanks!
Tried to print out the $mybb->array content, added the code in the file inc/class_error.php,
function error($type, $message, $file=null, $line=0)
{
global $mybb;
// testing code added here
echo "<pre>";
print_r($mybb->settings);
echo "</pre>";
...
}
It turns out the $mybb->settings is an empty array.