Fix: Log level for error must be LOG_ERR and not LOG_ERROR

This commit is contained in:
Laurent Destailleur 2008-08-02 11:44:17 +00:00
parent 1a9e1a896f
commit 5b01f35870
6 changed files with 26 additions and 25 deletions

View File

@ -364,6 +364,7 @@ $outfile='out.'.$classmin.'_script.php';
$targetcontent=$sourcecontent; $targetcontent=$sourcecontent;
// Substitute class name // Substitute class name
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
$targetcontent=preg_replace('/skeleton_script\.php/', $classmin.'_script.php', $targetcontent); $targetcontent=preg_replace('/skeleton_script\.php/', $classmin.'_script.php', $targetcontent);
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent); $targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent); $targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);

View File

@ -61,14 +61,14 @@ if (! isset($argv[1])) {
@set_time_limit(0); @set_time_limit(0);
// Show parameters // Show parameters
// print 'Arg1='.$argv[1]."\n"; print 'Argument 1='.$argv[1]."\n";
// print 'Arg2='.$argv[2]."\n"; print 'Argument 2='.$argv[2]."\n";
// Example for inserting creating object in database // Example for inserting creating object in database
/* /*
require_once(DOL_DOCUMENT_ROOT."/../dev/skeletons/skeleton_class.class.php"); require_once(DOL_DOCUMENT_ROOT."/../dev/skeletons/skeleton_class.class.php");
dolibarr_syslog($script_file." DELETE", LOG_DEBUG); dolibarr_syslog($script_file." CREATE", LOG_DEBUG);
$myobject=new Skeleton_class($db); $myobject=new Skeleton_class($db);
$id=$myobject->create($user); $id=$myobject->create($user);
if ($id < 0) dolibarr_print_error($db,$myobject->error); if ($id < 0) dolibarr_print_error($db,$myobject->error);

View File

@ -518,7 +518,7 @@ class Adherent extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dolibarr_syslog("Adherent::update ".$this->error,LOG_ERROR); dolibarr_syslog("Adherent::update ".$this->error,LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@ -568,7 +568,7 @@ class Adherent extends CommonObject
if ($result < 0) if ($result < 0)
{ {
$this->error=$luser->error; $this->error=$luser->error;
dolibarr_syslog("Adherent::update ".$this->error,LOG_ERROR); dolibarr_syslog("Adherent::update ".$this->error,LOG_ERR);
$error++; $error++;
} }
} }
@ -610,7 +610,7 @@ class Adherent extends CommonObject
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dolibarr_syslog("Adherent::update ".$this->error,LOG_ERROR); dolibarr_syslog("Adherent::update ".$this->error,LOG_ERR);
return -1; return -1;
} }
} }
@ -814,7 +814,7 @@ class Adherent extends CommonObject
if ($result < 0) if ($result < 0)
{ {
$this->error=$luser->error; $this->error=$luser->error;
dolibarr_syslog("Adherent::password ".$this->error,LOG_ERROR); dolibarr_syslog("Adherent::password ".$this->error,LOG_ERR);
$error++; $error++;
} }
} }

View File

@ -1420,7 +1420,7 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='',
} }
else else
{ {
dolibarr_syslog("functions.lib.php::restrictedArea sql=".$sql, LOG_ERROR); dolibarr_syslog("functions.lib.php::restrictedArea sql=".$sql, LOG_ERR);
accessforbidden(); accessforbidden();
} }
} }
@ -1467,12 +1467,12 @@ function accessforbidden($message='',$printheader=1)
/** /**
\brief Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remont<EFBFBD>e des bugs. * \brief Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remont<EFBFBD>e des bugs.
On doit appeler cette fonction quand une erreur technique bloquante est rencontr<EFBFBD>e. * On doit appeler cette fonction quand une erreur technique bloquante est rencontree.
Toutefois, il faut essayer de ne l'appeler qu'au sein de pages php, les classes devant * Toutefois, il faut essayer de ne l'appeler qu'au sein de pages php, les classes devant
renvoyer leur erreur par l'interm<EFBFBD>diaire de leur propri<EFBFBD>t<EFBFBD> "error". * renvoyer leur erreur par l'intermediaire de leur propriete "error".
\param db Handler de base utilis<EFBFBD> * \param db Database handler
\param error Chaine erreur ou tableau de chaines erreur compl<EFBFBD>mentaires a afficher * \param error Chaine erreur ou tableau de chaines erreur complementaires a afficher
*/ */
function dolibarr_print_error($db='',$error='') function dolibarr_print_error($db='',$error='')
{ {
@ -1513,19 +1513,19 @@ function dolibarr_print_error($db='',$error='')
print "<br>\n"; print "<br>\n";
print "<b>".$langs->trans("DatabaseTypeManager").":</b> ".$db->type."<br>\n"; print "<b>".$langs->trans("DatabaseTypeManager").":</b> ".$db->type."<br>\n";
print "<b>".$langs->trans("RequestLastAccessInError").":</b> ".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."<br>\n"; print "<b>".$langs->trans("RequestLastAccessInError").":</b> ".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."<br>\n";
print "<b>".$langs->trans("ReturnCodeLastAccess").":</b> ".$db->errno()."<br>\n"; print "<b>".$langs->trans("ReturnCodeLastAccess").":</b> ".$db->lasterrno()."<br>\n";
print "<b>".$langs->trans("InformationLastAccess").":</b> ".$db->error()."<br>\n"; print "<b>".$langs->trans("InformationLastAccess").":</b> ".$db->lasterror()."<br>\n";
} }
else // Mode CLI else // Mode CLI
{ {
print $langs->transnoentities("DatabaseTypeManager").":\n".$db->type."\n"; print $langs->transnoentities("DatabaseTypeManager").":\n".$db->type."\n";
print $langs->transnoentities("RequestLastAccessInError").":\n".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."\n"; print $langs->transnoentities("RequestLastAccessInError").":\n".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."\n";
print $langs->transnoentities("ReturnCodeLastAccess").":\n".$db->errno()."\n"; print $langs->transnoentities("ReturnCodeLastAccess").":\n".$db->lasterrno()."\n";
print $langs->transnoentities("InformationLastAccess").":\n".$db->error()."\n"; print $langs->transnoentities("InformationLastAccess").":\n".$db->lasterror()."\n";
} }
$syslog.=", sql=".$db->lastquery(); $syslog.=", sql=".$db->lastquery();
$syslog.=", db_error=".$db->error(); $syslog.=", db_error=".$db->lasterror();
} }
if ($error) if ($error)
@ -1550,7 +1550,7 @@ function dolibarr_print_error($db='',$error='')
} }
} }
dolibarr_syslog("Error $syslog",LOG_ERROR); dolibarr_syslog("Error ".$syslog, LOG_ERR);
} }
@ -1730,7 +1730,7 @@ function dol_delete_file($file)
{ {
$ok=unlink($filename); $ok=unlink($filename);
if ($ok) dolibarr_syslog("Removed file $filename",LOG_DEBUG); if ($ok) dolibarr_syslog("Removed file $filename",LOG_DEBUG);
else dolibarr_syslog("Failed to remove file $filename",LOG_ERROR); else dolibarr_syslog("Failed to remove file $filename",LOG_ERR);
} }
return $ok; return $ok;
} }

View File

@ -422,7 +422,7 @@ class Ldap
if ($result <= 0) if ($result <= 0)
{ {
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection)." ".$this->error; $this->error = ldap_errno($this->connection)." ".ldap_error($this->connection)." ".$this->error;
dolibarr_syslog("Ldap::update ".$this->error,LOG_ERROR); dolibarr_syslog("Ldap::update ".$this->error,LOG_ERR);
//print_r($info); //print_r($info);
return -1; return -1;
} }

View File

@ -1042,7 +1042,7 @@ class User extends CommonObject
if ($result < 0) if ($result < 0)
{ {
$this->error=$luser->error; $this->error=$luser->error;
dolibarr_syslog("User::update ".$this->error,LOG_ERROR); dolibarr_syslog("User::update ".$this->error,LOG_ERR);
$error++; $error++;
} }
} }
@ -1080,7 +1080,7 @@ class User extends CommonObject
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dolibarr_syslog("User::update ".$this->error,LOG_ERROR); dolibarr_syslog("User::update ".$this->error,LOG_ERR);
return -1; return -1;
} }
@ -1187,7 +1187,7 @@ class User extends CommonObject
if ($result < 0) if ($result < 0)
{ {
$this->error=$adh->error; $this->error=$adh->error;
dolibarr_syslog("User::password ".$this->error,LOG_ERROR); dolibarr_syslog("User::password ".$this->error,LOG_ERR);
$error++; $error++;
} }
} }