HOR-2195
.
This commit is contained in:
@@ -3035,5 +3035,20 @@ class Bootstrap
|
|||||||
$registerLogger = &MonologProvider::getSingleton($channel, $fileLog);
|
$registerLogger = &MonologProvider::getSingleton($channel, $fileLog);
|
||||||
$registerLogger->addLog($level, $message, $context);
|
$registerLogger->addLog($level, $message, $context);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the default information from the context
|
||||||
|
*
|
||||||
|
* @return array $aContext void
|
||||||
|
*/
|
||||||
|
public static function getDefaultContextLog(){
|
||||||
|
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
|
||||||
|
$date = \ProcessMaker\Util\DateTime::convertUtcToTimeZone(date('Y-m-d H:m:s'));
|
||||||
|
$aContext = array(
|
||||||
|
'ip' => \G::getIpAddress()
|
||||||
|
,'timeZone' => $date
|
||||||
|
,'workspace' => $sysSys
|
||||||
|
);
|
||||||
|
return $aContext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,9 @@ class pmDynaform
|
|||||||
|
|
||||||
public function jsonr(&$json)
|
public function jsonr(&$json)
|
||||||
{
|
{
|
||||||
|
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
|
||||||
|
$aContext = \Bootstrap::getDefaultContextLog();
|
||||||
|
|
||||||
if (empty($json)) {
|
if (empty($json)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -238,6 +241,10 @@ class pmDynaform
|
|||||||
$stmt = $cnn->createStatement();
|
$stmt = $cnn->createStatement();
|
||||||
$sql = G::replaceDataField($json->sql, $this->getValuesDependentFields($json));
|
$sql = G::replaceDataField($json->sql, $this->getValuesDependentFields($json));
|
||||||
$rs = $stmt->executeQuery($sql, \ResultSet::FETCHMODE_NUM);
|
$rs = $stmt->executeQuery($sql, \ResultSet::FETCHMODE_NUM);
|
||||||
|
//Logger
|
||||||
|
$aContext['action'] = 'execute-sql';
|
||||||
|
$aContext['sql'] = $sql;
|
||||||
|
\Bootstrap::registerMonolog('sqlExecution', 200, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
|
||||||
while ($rs->next()) {
|
while ($rs->next()) {
|
||||||
$row = $rs->getRow();
|
$row = $rs->getRow();
|
||||||
$option = new stdClass();
|
$option = new stdClass();
|
||||||
@@ -246,6 +253,10 @@ class pmDynaform
|
|||||||
$json->optionsSql[] = $option;
|
$json->optionsSql[] = $option;
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
//Logger
|
||||||
|
$aContext['action'] = 'execute-sql';
|
||||||
|
$aContext['exception'] = (array)$e;
|
||||||
|
\Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,6 +240,8 @@ function literalDate ($date, $lang = 'en')
|
|||||||
*/
|
*/
|
||||||
function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter = array())
|
function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter = array())
|
||||||
{
|
{
|
||||||
|
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
|
||||||
|
$aContext = \Bootstrap::getDefaultContextLog();
|
||||||
$con = Propel::getConnection( $DBConnectionUID );
|
$con = Propel::getConnection( $DBConnectionUID );
|
||||||
$con->begin();
|
$con->begin();
|
||||||
G::loadClass('system');
|
G::loadClass('system');
|
||||||
@@ -342,9 +344,18 @@ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
|
|||||||
$result = executeQueryOci($SqlStatement, $con, $aParameter);
|
$result = executeQueryOci($SqlStatement, $con, $aParameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Logger
|
||||||
|
$aContext['action'] = 'execute-query';
|
||||||
|
$aContext['sql'] = $SqlStatement;
|
||||||
|
\Bootstrap::registerMonolog('sqlExecution', 200, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
} catch (SQLException $sqle) {
|
} catch (SQLException $sqle) {
|
||||||
|
//Logger
|
||||||
|
$aContext['action'] = 'execute-query';
|
||||||
|
$aContext['exception'] = (array)$sqle;
|
||||||
|
\Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
|
||||||
|
|
||||||
if (isset($sqle->xdebug_message)) {
|
if (isset($sqle->xdebug_message)) {
|
||||||
error_log(print_r($sqle->xdebug_message, true));
|
error_log(print_r($sqle->xdebug_message, true));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -711,6 +711,8 @@ class Variable
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$arrayRecord = array();
|
$arrayRecord = array();
|
||||||
|
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
|
||||||
|
$aContext = \Bootstrap::getDefaultContextLog();
|
||||||
|
|
||||||
//Verify data
|
//Verify data
|
||||||
$process = new \ProcessMaker\BusinessModel\Process();
|
$process = new \ProcessMaker\BusinessModel\Process();
|
||||||
@@ -791,6 +793,10 @@ class Variable
|
|||||||
);
|
);
|
||||||
$rs = $stmt->executeQuery($replaceFields, \ResultSet::FETCHMODE_NUM);
|
$rs = $stmt->executeQuery($replaceFields, \ResultSet::FETCHMODE_NUM);
|
||||||
|
|
||||||
|
//Logger
|
||||||
|
$aContext['action'] = 'execute-sql-suggest';
|
||||||
|
$aContext['sql'] = $replaceFields;
|
||||||
|
\Bootstrap::registerMonolog('sqlExecution', 200, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
|
||||||
while ($rs->next()) {
|
while ($rs->next()) {
|
||||||
$row = $rs->getRow();
|
$row = $rs->getRow();
|
||||||
|
|
||||||
@@ -805,6 +811,10 @@ class Variable
|
|||||||
//Return
|
//Return
|
||||||
return $arrayRecord;
|
return $arrayRecord;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
//Logger
|
||||||
|
$aContext['action'] = 'execute-sql-suggest';
|
||||||
|
$aContext['exception'] = (array)$e;
|
||||||
|
\Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user