![]() |
Documentación GVHIDRA 3.1.5
|
Métodos públicos estáticos | |
static | setDebug ($tipo, $mensaje) |
static | _setDB ($tipo, $mensaje, $aplicacion, $modulo, $version, $usuario) |
Definición en la línea 55 del archivo IgepDebug.php.
static _setDB | ( | $ | tipo, |
$ | mensaje, | ||
$ | aplicacion, | ||
$ | modulo, | ||
$ | version, | ||
$ | usuario | ||
) | [static] |
Definición en la línea 91 del archivo IgepDebug.php.
{ // variable static para controlar el acceso exclusivo al metodo, y avitar asi bucles // infinitos provocados por los propios errores dentro del metodo static $excl = false; static $conexion=null; static $ins_prepared=null; static $horabd=null; include_once "IgepConexion.php"; $conf = ConfigFramework::getConfig(); $dsn_log = $conf->getDSNLog(); if(empty($dsn_log)) return; //Conexion persistente para el log $conexion = $conf->getLogConnection(); if(!is_object($conexion->obj_conexion)) { if ($excl === true) { $excl = false; throw new Exception('Error de conexin al debug, desactivelo (pase a LOG_NONE) o corrija el problema. Posiblemente se trata de un error en los parmetros de conexion. La descripccin del problema es: '.$conexion->obj_conexion->userinfo); } $conexion = new IgepConexion($dsn_log,true); $conf->setLogConnection($conexion); } $excl = true; if (PEAR::isError($conexion->obj_conexion)) throw new Exception('Error de conexin al debug, desactivelo (pase a LOG_NONE) o corrija el problema. Posiblemente se trata de un error en los parmetros de conexion. La descripccin del problema es: '.$conexion->obj_conexion->userinfo); //Obtenemos la fecha en el formato que admita la BD $fechabd = IgepDB::mascaraFechas($dsn_log); if (is_null($horabd)) $horabd = $conf->getTimeMask(); $fecha = date($fechabd.' '.$horabd); if (IgepDB::obtenerDBMS($dsn_log)=='mysql') { $iderror = 'null'; } else { $sql = IgepDB::obtenerSecuenciaBD($dsn_log,'scmn_id_errlog'); $res = $conexion->obj_conexion->query($sql); if (PEAR::isError($res)) { $excl = false; throw new Exception('Error al obtener secuencia de scmn_id_errlog: '.$res->userinfo); } $iderror = $res->fetchOne('nextval'); } $conexion->obj_conexion->beginTransaction(); if (empty($ins_prepared)) { $ins = "INSERT INTO tcmn_errlog (iderror,aplicacion,modulo,version,usuario,fecha,tipo,mensaje) values(?,?,null,?,?,?,?,?)"; $ins_prepared = $conexion->obj_conexion->prepare($ins, array('integer','text','text','text','text','text','text')); if (PEAR::isError($ins_prepared)) { $excl = false; $prep = $ins_prepared; $ins_prepared = null; $conexion->obj_conexion->rollback(); throw new Exception('Error preparando insercin en tcmn_errlog: '.$prep->userinfo); } } $res = $ins_prepared->execute(array($iderror,$aplicacion,$version,$usuario,$fecha, $tipo, $mensaje)); $excl = false; if (PEAR::isError($res)) { $conexion->obj_conexion->rollback(); throw new Exception('Error al insertar en tcmn_errlog: '.$res->userinfo); } $conexion->obj_conexion->commit(); }
static setDebug | ( | $ | tipo, |
$ | mensaje | ||
) | [static] |
Definición en la línea 57 del archivo IgepDebug.php.
{ if (!is_numeric($tipo)) throw new Exception('IgepDebug: el tipo de mensaje no est definido: '.$tipo); include_once "IgepConstants.php"; $configuration = ConfigFramework::getConfig(); $debug = $configuration->getLogStatus(); //Comprobamos si tenemos que insertar if($tipo>=$debug) return; //Obtenemos los datos $aplicacion = IgepSession::dameAplicacion(); $modulo = ''; $version = $configuration->getAppVersion(); if (strlen($version) > 10) $version = substr($version,-10); $usuario = IgepSession::dameUsuario(); if (empty($usuario)) { $usuario = $_SERVER['REMOTE_ADDR']; if (empty($usuario)) $usuario = 'UNKNOWN'; if (class_exists('IgepWS_Server')) { $login_cred = IgepWS_Server::getUsername(); if (!is_null($login_cred)) $usuario = strtoupper($login_cred).'@'.$usuario; } } //reemplazamos caracter octal 0 con string \000 (relacionados con serializacin de objetos) $mensaje = str_replace("\000",'\\000',$mensaje); //Realizamos la insercion IgepDebug::_setDB($tipo, $mensaje, $aplicacion, $modulo, $version, $usuario); }