Modify query_error() to log errors to a database table instead of displaying them on the screen. This should
let us more easily debug difficult or intermittent issues that users may not report. Add a cron to report logged errors to appdb admins every night. Implement some basic unit tests for the new error logging code
This commit is contained in:
@@ -113,11 +113,10 @@ function query_bugzilladb($sQuery,$sComment="")
|
||||
|
||||
function query_error($sQuery, $sComment="")
|
||||
{
|
||||
$sStatusMessage = "<p><b>Database Error!</b><br />";
|
||||
$sStatusMessage .= "Query: ".$sQuery."<br />";
|
||||
$sStatusMessage .= $sComment ? $sComment."<br />" : "";
|
||||
$sStatusMessage .= mysql_error()."</p>\n";
|
||||
addmsg($sStatusMessage, "red");
|
||||
$sStatusMessage = "<p><b>An internal error has occurred and has been logged and reported to appdb admins</b></p>";
|
||||
addmsg($sStatusMessage);
|
||||
|
||||
error_log::log_error(ERROR_SQL, "Query: '".$sQuery."' mysql_error(): '".mysql_error()."' comment: '".$sComment."'");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user