PMCORE-1335 ProcessMaker core should be use the native Laravel log mechanism.

This commit is contained in:
Roly Rudy Gutierrez Pinto
2020-08-10 17:11:55 -04:00
parent 061d4531f1
commit c865e65658
45 changed files with 731 additions and 1535 deletions

View File

@@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Log;
use ProcessMaker\BusinessModel\EmailServer;
use ProcessMaker\Core\System;
use ProcessMaker\Services\Api\Project\Variable;
@@ -565,11 +566,11 @@ class ActionsByEmailCoreClass extends PMPlugin
if (empty($data->DEL_INDEX)) {
throw new Exception('The parameter $data->DEL_INDEX is null or empty.');
} elseif ($data->DEL_INDEX === 1) {
// Processmaker log
$context = Bootstrap::getDefaultContextLog();
$context['delIndex'] = $data->DEL_INDEX;
Bootstrap::registerMonolog('ActionByEmail', 250, 'Actions by email does not work in the initial task', $context);
$message = 'Actions by email does not work in the initial task';
$context = [
'delIndex' => $data->DEL_INDEX
];
Log::channel(':ActionByEmail')->notice($message, Bootstrap::context($context));
return;
} else {
$this->setIndex($data->DEL_INDEX);

View File

@@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Log;
use ProcessMaker\BusinessModel\User as BusinessModelUser;
use ProcessMaker\BusinessModel\WebEntryEvent;
use ProcessMaker\Cases\CasesTrait;
@@ -1099,7 +1100,12 @@ class Cases
$oDerivation->verifyIsCaseChild($sAppUid);
}
} catch (Exception $e) {
Bootstrap::registerMonolog('DeleteCases', 200, 'Error in sub-process when trying to route a child case related to the case', ['application_uid' => $sAppUid, 'error' => $e->getMessage()], config("system.workspace"), 'processmaker.log');
$message = 'Error in sub-process when trying to route a child case related to the case';
$context = [
'application_uid' => $sAppUid,
'error' => $e->getMessage()
];
Log::channel(':DeleteCases')->info($message, Bootstrap::context($context));
}
//Delete the registries in the table SUB_APPLICATION
@@ -1153,12 +1159,13 @@ class Cases
}
}
/** ProcessMaker log*/
$context = Bootstrap::getDefaultContextLog();
$context['appUid'] = $appUidCopy;
$context['request'] = $nameFiles;
Bootstrap::registerMonolog('DeleteCases', 200, 'Delete Case', $context);
/** ProcessMaker log */
$message = 'Delete Case';
$context = [
'appUid' => $appUidCopy,
'request' => $nameFiles
];
Log::channel(':DeleteCases')->info($message, Bootstrap::context($context));
return $result;
} catch (exception $e) {
throw ($e);
@@ -2259,7 +2266,8 @@ class Cases
}
//Log
$data = [
$message = 'Create case';
$context = $data = [
"appUid" => $sAppUid,
"usrUid" => $sUsrUid,
"tasUid" => $sTasUid,
@@ -2268,8 +2276,7 @@ class Cases
"delIndex" => $iDelIndex,
"appInitDate" => $Fields['APP_INIT_DATE']
];
Bootstrap::registerMonolog('CreateCase', 200, "Create case", $data, config("system.workspace"), 'processmaker.log');
Log::channel(':CreateCase')->info($message, Bootstrap::context($context));
//call plugin
if (class_exists('folderData')) {
$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $newValues['APP_TITLE'], $sUsrUid);
@@ -5517,17 +5524,19 @@ class Cases
$from = $fromName . (($fromMail != '') ? ' <' . $fromMail . '>' : '');
//If the configuration was not configured correctly
if (empty($fromMail)) {
$dataLog = \Bootstrap::getDefaultContextLog();
$dataLog['appUid'] = $arrayData['APPLICATION'];
$dataLog['usrUid'] = $arrayData['USER_LOGGED'];
$dataLog['appNumber'] = $arrayData['APP_NUMBER'];
$dataLog['tasUid'] = $arrayData['TASK'];
$dataLog['proUid'] = $aTaskInfo['PRO_UID'];
$dataLog['appMessageStatus'] = 'pending';
$dataLog['subject'] = $sSubject;
$dataLog['from'] = $from;
$dataLog['action'] = G::LoadTranslation('ID_EMAIL_SERVER_FROM_MAIL_EMPTY');
Bootstrap::registerMonolog('EmailServer', 300, 'Email server', $dataLog, $dataLog['workspace'], 'processmaker.log');
$message = 'Email server';
$context = [
'appUid' => $arrayData['APPLICATION'],
'usrUid' => $arrayData['USER_LOGGED'],
'appNumber' => $arrayData['APP_NUMBER'],
'tasUid' => $arrayData['TASK'],
'proUid' => $aTaskInfo['PRO_UID'],
'appMessageStatus' => 'pending',
'subject' => $sSubject,
'from' => $from,
'action' => G::LoadTranslation('ID_EMAIL_SERVER_FROM_MAIL_EMPTY')
];
Log::channel(':EmailServer')->warning($message, Bootstrap::context($context));
}
}
$dataLastEmail['msgError'] = $msgError;
@@ -5598,17 +5607,19 @@ class Cases
$from = $fromName . (($fromMail != '') ? ' <' . $fromMail . '>' : '');
//If the configuration was not configured correctly
if (empty($fromMail)) {
$dataLog = \Bootstrap::getDefaultContextLog();
$dataLog['appUid'] = $arrayData['APPLICATION'];
$dataLog['usrUid'] = $arrayData['USER_LOGGED'];
$dataLog['appNumber'] = $arrayData['APP_NUMBER'];
$dataLog['tasUid'] = $arrayData['TASK'];
$dataLog['proUid'] = $aTaskInfo['PRO_UID'];
$dataLog['appMessageStatus'] = 'pending';
$dataLog['subject'] = $sSubject;
$dataLog['from'] = $from;
$dataLog['action'] = G::LoadTranslation('ID_EMAIL_SERVER_FROM_MAIL_EMPTY');
Bootstrap::registerMonolog('EmailServer', 300, 'Email server', $dataLog, $dataLog['workspace'], 'processmaker.log');
$message = 'Email server';
$context = [
'appUid' => $arrayData['APPLICATION'],
'usrUid' => $arrayData['USER_LOGGED'],
'appNumber' => $arrayData['APP_NUMBER'],
'tasUid' => $arrayData['TASK'],
'proUid' => $aTaskInfo['PRO_UID'],
'appMessageStatus' => 'pending',
'subject' => $sSubject,
'from' => $from,
'action' => G::LoadTranslation('ID_EMAIL_SERVER_FROM_MAIL_EMPTY')
];
Log::channel(':EmailServer')->warning($message, Bootstrap::context($context));
}
}
$dataLastEmail['msgError'] = $msgError;
@@ -7357,6 +7368,7 @@ class Cases
$additionalTables = new AdditionalTables();
$listTables = $additionalTables->getReportTables($applicationFields["PRO_UID"]);
$pmTable = new PmTable();
$tableName = '';
foreach ($listTables as $row) {
try {
$tableName = $row["ADD_TAB_NAME"];
@@ -7367,11 +7379,13 @@ class Cases
$criteria->add($pmTablePeer::APP_UID, $applicationUid);
$pmTablePeer::doDelete($criteria);
} catch (Exception $e) {
$context = Bootstrap::getDefaultContextLog();
$context['appUid'] = $applicationUid;
$context['proUid'] = $applicationFields["PRO_UID"];
$context['reportTable'] = $tableName;
Bootstrap::registerMonolog('DeleteCases', 400, $e->getMessage(), $context);
$message = $e->getMessage();
$context = [
'appUid' => $applicationUid,
'proUid' => $applicationFields["PRO_UID"],
'reportTable' => $tableName
];
Log::channel(':DeleteCases')->error($message, Bootstrap::context($context));
}
}
}

View File

@@ -1,9 +1,6 @@
<?php
/**
* Route case
*/
use Illuminate\Support\Facades\Log;
use ProcessMaker\Model\Application as ModelApplication;
use ProcessMaker\Model\SubApplication as ModelSubApplication;
@@ -138,8 +135,8 @@ class Derivation
$arrayApplicationData = $this->case->loadCase($arrayData["APP_UID"]);
$arrayNextTask = array();
$arrayNextTaskDefault = array();
$arrayNextTask = [];
$arrayNextTaskDefault = [];
$i = 0;
$criteria = new Criteria("workflow");
@@ -168,7 +165,7 @@ class Derivation
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$flagDefault = false;
$aSecJoin = array();
$aSecJoin = [];
$count = 0;
while ($rsCriteria->next()) {
@@ -228,7 +225,7 @@ class Derivation
//Check Task GATEWAYTOGATEWAY, END-MESSAGE-EVENT, END-EMAIL-EVENT
$arrayNextTaskBackup = $arrayNextTask;
$arrayNextTask = array();
$arrayNextTask = [];
$i = 0;
foreach ($arrayNextTaskBackup as $value) {
$arrayNextTaskData = $value;
@@ -694,7 +691,7 @@ class Derivation
}
//Element origin and dest
$arrayElement = array();
$arrayElement = [];
$elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
$arrayElementTaskRelationData = $elementTaskRelation->getElementTaskRelationWhere(
[
@@ -705,7 +702,7 @@ class Derivation
true
);
if(is_null($arrayElementTaskRelationData)){
$arrayOtherElement = array();
$arrayOtherElement = [];
$arrayOtherElement = $bpmn->getElementsBetweenElementOriginAndElementDest(
$elementOriUid,
"bpmnActivity",
@@ -731,9 +728,9 @@ class Derivation
$arrayEventExecute = ["BEFORE" => $flagEventExecuteBeforeGateway, "AFTER" => $flagEventExecuteAfterGateway];
$positionEventExecute = "BEFORE";
$aContext = $this->context;
$aContext['appUid'] = $applicationData["APP_UID"];
$aContext['proUid'] = $applicationData["PRO_UID"];
$context = $this->context;
$context['appUid'] = $applicationData["APP_UID"];
$context['proUid'] = $applicationData["PRO_UID"];
if(sizeof($arrayElement)){
foreach ($arrayElement as $value) {
switch ($value['type']) {
@@ -746,24 +743,26 @@ class Derivation
//Message-Application throw
$result = $messageApplication->create($applicationData["APP_UID"], $applicationData["PRO_UID"], $value['uid'], $applicationData);
$aContext['envUid'] = $value['uid'];
$aContext['envType'] = $event->getEvnType();
$aContext['envMarker'] = $event->getEvnMarker();
$aContext['action'] = 'Message application throw';
$context['envUid'] = $value['uid'];
$context['envType'] = $event->getEvnType();
$context['envMarker'] = $event->getEvnMarker();
$context['action'] = 'Message application throw';
//Logger
Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log');
$message = 'Case Derivation';
Log::channel(':CaseDerivation')->info($message, Bootstrap::context($context));
}
if (preg_match("/^(?:END|INTERMEDIATE)$/", $event->getEvnType()) && $event->getEvnMarker() === 'EMAIL') {
//Email-Event throw
$result = $emailEvent->sendEmail($applicationData["APP_UID"], $applicationData["PRO_UID"], $value['uid'], $applicationData, $tasId);
$aContext['envUid'] = $value['uid'];
$aContext['envType'] = $event->getEvnType();
$aContext['envMarker'] = $event->getEvnMarker();
$aContext['action'] = 'Email event throw';
$context['envUid'] = $value['uid'];
$context['envType'] = $event->getEvnType();
$context['envMarker'] = $event->getEvnMarker();
$context['action'] = 'Email event throw';
//Logger
Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log');
$message = 'Case Derivation';
Log::channel(':CaseDerivation')->info($message, Bootstrap::context($context));
}
}
}
@@ -845,7 +844,7 @@ class Derivation
$nextTasks = $oRoute->mergeDataDerivation($tasks, $aPInformation, $rouType);
//Get all route types
$aRouteTypes = array();
$aRouteTypes = [];
foreach ($aPInformation as $key => $value) {
$aRouteTypes[$key]['ROU_NEXT_TASK'] = $value['ROU_NEXT_TASK'];
$aRouteTypes[$key]['ROU_TYPE'] = $value['ROU_TYPE'];
@@ -876,8 +875,8 @@ class Derivation
function derivate(array $currentDelegation, array $nextDelegations, $removeList = true)
{
$this->sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined";
$this->context = Bootstrap::getDefaultContextLog();
$aContext = $this->context;
$this->context = Bootstrap::context();
$context = $this->context;
$this->removeList = $removeList;
$arrayDerivationResult = [];
@@ -893,8 +892,8 @@ class Derivation
//Get data for this DEL_INDEX current
$appFields = $this->case->loadCase( $currentDelegation['APP_UID'], $currentDelegation['DEL_INDEX'] );
$aContext['appUid'] = $currentDelegation['APP_UID'];
$aContext['delIndex'] = $currentDelegation['DEL_INDEX'];
$context['appUid'] = $currentDelegation['APP_UID'];
$context['delIndex'] = $currentDelegation['DEL_INDEX'];
// Remove the fields that will update with the thread creation
unset($appFields['APP_ROUTING_DATA']);
@@ -923,7 +922,7 @@ class Derivation
$currentDelegation["TAS_MI_COMPLETE_VARIABLE"] = $task->getTasMiCompleteVariable();
$currentDelegation["TAS_MI_INSTANCE_VARIABLE"] = $task->getTasMiInstanceVariable();
$arrayNextDerivation = array();
$arrayNextDerivation = [];
$flagFirstIteration = true;
foreach ($nextDelegations as $nextDel) {
@@ -965,7 +964,7 @@ class Derivation
$this->flagUpdateList = true;
$aContext['tasUid'] = $nextDel['TAS_UID'];
$context['tasUid'] = $nextDel['TAS_UID'];
switch ($nextDel['TAS_UID']) {
case TASK_FINISH_PROCESS:
$this->finishProcess(
@@ -973,7 +972,7 @@ class Derivation
$nextDel,
$appFields,
$flagFirstIteration,
$aContext
$context
);
break;
case TASK_FINISH_TASK:
@@ -983,7 +982,7 @@ class Derivation
$appFields,
$flagFirstIteration,
$flagTaskAssignTypeIsMultipleInstance,
$aContext
$context
);
break;
default:
@@ -1354,7 +1353,7 @@ class Derivation
if (isset($aDeriveTasks[1])) {
if ($aDeriveTasks[1]['ROU_TYPE'] != 'SELECT') {
$nextDelegations2 = array();
$nextDelegations2 = [];
foreach ($aDeriveTasks as $aDeriveTask) {
$nextDelegations2[] = array(
'TAS_UID' => $aDeriveTask['NEXT_TASK']['TAS_UID'],
@@ -1869,7 +1868,7 @@ class Derivation
{
try {
if ($nextDel['TAS_RECEIVE_LAST_EMAIL'] == 'TRUE') {
$taskData = array();
$taskData = [];
$userLogged = $this->userLogged->load($appFields['APP_DATA']['USER_LOGGED']);
$fromName = $userLogged['USR_FIRSTNAME'] . ' ' . $userLogged['USR_LASTNAME'];
$sFromData = $fromName . ($userLogged['USR_EMAIL'] != '' ? ' <' . $userLogged['USR_EMAIL'] . '>' : '');
@@ -1899,10 +1898,10 @@ class Derivation
* @param array $appFields
* @param boolean $flagFirstIteration
* @param boolean $flagTaskAssignTypeIsMultipleInstance
* @param array $aContext
* @param array $context
* @return void
*/
public function finishTask($currentDelegation, $nextDel, $appFields, $flagFirstIteration = true, $flagTaskAssignTypeIsMultipleInstance = false, $aContext = array()) {
public function finishTask($currentDelegation, $nextDel, $appFields, $flagFirstIteration = true, $flagTaskAssignTypeIsMultipleInstance = false, $context = []) {
$iAppThreadIndex = $appFields['DEL_THREAD'];
$this->case->closeAppThread($currentDelegation['APP_UID'], $iAppThreadIndex);
if (isset($nextDel["TAS_UID_DUMMY"])) {
@@ -1940,9 +1939,10 @@ class Derivation
);
}
}
$aContext['action'] = 'finish-task';
$context['action'] = 'finish-task';
//Logger
Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log');
$message = 'Case Derivation';
Log::channel(':CaseDerivation')->info($message, Bootstrap::context($context));
}
/**
@@ -1952,10 +1952,10 @@ class Derivation
* @param array $nextDel
* @param array $appFields
* @param boolean $flagFirstIteration
* @param array $aContext
* @param array $context
* @return void
*/
public function finishProcess($currentDelegation, $nextDel, $appFields, $flagFirstIteration = true, $aContext = array()){
public function finishProcess($currentDelegation, $nextDel, $appFields, $flagFirstIteration = true, $context = []){
/*Close all delegations of $currentDelegation['APP_UID'] */
$this->case->closeAllDelegations( $currentDelegation['APP_UID'] );
$this->case->closeAllThreads( $currentDelegation['APP_UID'] );
@@ -1987,9 +1987,10 @@ class Derivation
);
}
}
$aContext['action'] = 'end-process';
$context['action'] = 'end-process';
//Logger
Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log');
$message = 'Case Derivation';
Log::channel(':CaseDerivation')->info($message, Bootstrap::context($context));
}
/**
@@ -2003,7 +2004,7 @@ class Derivation
*/
public function getNextInfoSubProcess($nextDel, $proUid)
{
$newNextDel = array();
$newNextDel = [];
$oCriteria = new Criteria('workflow');
$oCriteria->add(SubProcessPeer::PRO_PARENT, $proUid);
$oCriteria->add(SubProcessPeer::TAS_PARENT, $nextDel['TAS_PARENT']);
@@ -2082,7 +2083,7 @@ class Derivation
*/
public function canRouteTypeSecJoin($flagMultipleInstance, $flagTypeMultipleInstance, $currentDelegation, $appFields, $nextDel)
{
$arrayOpenThread = ($flagMultipleInstance && $flagTypeMultipleInstance)? $this->case->searchOpenPreviousTasks($currentDelegation["TAS_UID"], $currentDelegation["APP_UID"]) : array();
$arrayOpenThread = ($flagMultipleInstance && $flagTypeMultipleInstance)? $this->case->searchOpenPreviousTasks($currentDelegation["TAS_UID"], $currentDelegation["APP_UID"]) : [];
if (
$flagMultipleInstance
@@ -2220,7 +2221,7 @@ class Derivation
*/
public function routePrepareInformationNextTask($currentDelegation, $iNewDelIndex, $nextDel)
{
$nextDelegationsAux = array();
$nextDelegationsAux = [];
$taskNextDelNextDelRouType = "";
$i = 0;
//Get for $nextDel["TAS_UID"] your next Task
@@ -2296,7 +2297,7 @@ class Derivation
* @param boolean $flagFirstIteration
* @return void
*/
public function doRouteWithoutThread($appFields, $currentDelegation, $nextDel, $arraySiblings = array(), $flagMultipleInstance = false, $flagTypeMultipleInstance = false, $flagFirstIteration = false)
public function doRouteWithoutThread($appFields, $currentDelegation, $nextDel, $arraySiblings = [], $flagMultipleInstance = false, $flagTypeMultipleInstance = false, $flagFirstIteration = false)
{
$iAppThreadIndex = $appFields['DEL_THREAD'];
$routeType = $currentDelegation["ROU_TYPE"];

View File

@@ -1,6 +1,7 @@
<?php
use \ProcessMaker\BusinessModel\User;
use Illuminate\Support\Facades\Log;
use ProcessMaker\BusinessModel\User;
/**
* class.ldapAdvanced.php
@@ -1127,10 +1128,12 @@ class LdapAdvanced
BasePeer::doUpdate($c1, $c2, $con);
}
} catch (Exception $e) {
$context = Bootstrap::getDefaultContextLog();
$context["action"] = "ldapSynchronize";
$context["authSource"] = $arrayAuthSource;
Bootstrap::registerMonolog("ldapSynchronize", 400, $e->getMessage(), $context, $context["workspace"], "processmaker.log");
$context = [
"action" => "ldapSynchronize",
"authSource" => $arrayAuthSource
];
$message = $e->getMessage();
Log::channel(':ldapSynchronize')->error($message, Bootstrap::context($context));
}
//Check ldap connection for user

View File

@@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Log;
use ProcessMaker\Core\System;
use ProcessMaker\BusinessModel\DynaForm\SuggestTrait;
use ProcessMaker\BusinessModel\Cases;
@@ -78,7 +79,7 @@ class PmDynaform
public function __construct($fields = [])
{
$this->sysSys = (!empty(config("system.workspace"))) ? config("system.workspace") : "Undefined";
$this->context = \Bootstrap::getDefaultContextLog();
$this->context = Bootstrap::context();
$this->dataSources = array("database", "dataVariable");
$this->pathRTLCss = '/lib/pmdynaform/build/css/PMDynaform-rtl.css';
$this->serverConf = ServerConf::getSingleton();
@@ -938,18 +939,16 @@ class PmDynaform
$this->context["action"] = "execute-sql" . $type;
$this->context["sql"] = $sql;
\Bootstrap::registerMonolog("sqlExecution", 200, "Sql Execution", $this->context, $this->sysSys, "processmaker.log");
$message = 'Sql Execution';
Log::channel(':sqlExecution')->info($message, Bootstrap::context($this->context));
}
} catch (Exception $e) {
$this->context["action"] = "execute-sql" . $type;
$this->context["exception"] = (array) $e;
$this->lastQueryError = $e;
\Bootstrap::registerMonolog("sqlExecution",
400,
"Sql Execution",
$this->basicExceptionData($e, $sql),
$this->sysSys,
"processmaker.log");
$message = 'Sql Execution';
$context = $this->basicExceptionData($e, $sql);
Log::channel(':sqlExecution')->error($message, Bootstrap::context($context));
}
return $data;
}
@@ -2385,14 +2384,13 @@ class PmDynaform
$jsonData = G::json_encode($json);
//Log
\Bootstrap::registerMonolog(
'RenderDynaForm',
400,
'JSON encoded string error ' . $jsonLastError . ': ' . $jsonLastErrorMsg,
['token' => $token, 'projectUid' => $this->record['PRO_UID'], 'dynaFormUid' => $this->record['DYN_UID']],
config("system.workspace"),
'processmaker.log'
);
$message = 'JSON encoded string error ' . $jsonLastError . ': ' . $jsonLastErrorMsg;
$context = [
'token' => $token,
'projectUid' => $this->record['PRO_UID'],
'dynaFormUid' => $this->record['DYN_UID']
];
Log::channel(':RenderDynaForm')->error($message, Bootstrap::context($context));
}
//Return

View File

@@ -1,5 +1,6 @@
<?php
use Illuminate\Support\Facades\Log;
use ProcessMaker\BusinessModel\EmailEvent;
use ProcessMaker\BusinessModel\Variable as BmVariable;
use ProcessMaker\Core\System;
@@ -4491,7 +4492,8 @@ class Processes
try {
$result = $scriptTask->create($processUid, $record);
} catch (Exception $e) {
Bootstrap::registerMonolog('DataError', 400, $e->getMessage(), $record, config("system.workspace"), 'processmaker.log');
$message = $e->getMessage();
Log::channel(':DataError')->error($message, Bootstrap::context($record));
}
}
} catch (Exception $e) {
@@ -5406,16 +5408,14 @@ class Processes
}
if ($bytesSaved != $fsContent) {
$channel = "writingMailTemplate";
$context = \Bootstrap::getDefaultContextLog();
$context = [];
$context['action'] = $channel;
if (defined("SYS_CURRENT_URI") && defined("SYS_CURRENT_PARMS")) {
$context['url'] = SYS_CURRENT_URI . '?' . SYS_CURRENT_PARMS;
}
$context['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '';
$sysSys = !empty(config("system.workspace")) ? config("system.workspace") : "Undefined";
$message = 'The imported template has a number of byes different than the original template, please verify if the file \'' . $newFileName . '\' is correct.';
$level = 400;
Bootstrap::registerMonolog($channel, $level, $message, $context, $sysSys, 'processmaker.log');
Log::channel(':' . $channel)->error($message, Bootstrap::context($context));
}
}
}

View File

@@ -2,6 +2,7 @@
use App\Jobs\GenerateReportTable;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use ProcessMaker\Core\JobsManager;
use ProcessMaker\Model\Application;
@@ -614,14 +615,12 @@ class ReportTables
try {
$rs = $stmt->executeQuery($sQuery);
} catch (Exception $e) {
Bootstrap::registerMonolog(
'sqlExecution',
400,
'Sql Execution',
['sql' => $sQuery, 'error' => $e->getMessage()],
config("system.workspace"),
'processmaker.log'
);
$message = 'Sql Execution';
$context = [
'sql' => $sQuery,
'error' => $e->getMessage()
];
Log::channel(':sqlExecution')->error($message, Bootstrap::context($context));
}
}
} else {
@@ -666,14 +665,12 @@ class ReportTables
try {
$rs = $stmt->executeQuery($sQuery);
} catch (Exception $e) {
Bootstrap::registerMonolog(
'sqlExecution',
400,
'Sql Execution',
['sql' => $sQuery, 'error' => $e->getMessage()],
config("system.workspace"),
'processmaker.log'
);
$message = 'Sql Execution';
$context = [
'sql' => $sQuery,
'error' => $e->getMessage()
];
Log::channel(':sqlExecution')->error($message, Bootstrap::context($context));
}
}
} else {

View File

@@ -1,13 +1,6 @@
<?php
/**
* spoolRun - brief send email from the spool database, and see if we have all the addresses we send to.
*
* @author Ian K Armstrong <ika@[REMOVE_THESE_CAPITALS]openmail.cc>
* @copyright Copyright (c) 2007, Ian K Armstrong
* @license http://www.opensource.org/licenses/gpl-3.0.html GNU Public License
* @link http://www.openmail.cc
*/
use Illuminate\Support\Facades\Log;
use ProcessMaker\Core\System;
/**
@@ -362,11 +355,13 @@ class SpoolRun
$appMessage->setAppMsgSendDate(date('Y-m-d H:i:s'));
$appMessage->save();
$context = Bootstrap::getDefaultContextLog();
$context["action"] = "Send email";
$context["appMsgUid"] = $this->getAppMsgUid();
$context["appUid"] = $this->getAppUid();
Bootstrap::registerMonolog("SendEmail", 400, $msgError, $context);
$message = $msgError;
$context = [
"action" => "Send email",
"appMsgUid" => $this->getAppMsgUid(),
"appUid" => $this->getAppUid()
];
Log::channel(':SendEmail')->error($message, Bootstrap::context($context));
}
/**

View File

@@ -2,6 +2,7 @@
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use ProcessMaker\BusinessModel\Process as BmProcess;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog;
@@ -4934,7 +4935,7 @@ class WorkspaceTools
}
}
$context = Bootstrap::getDefaultContextLog();
$context = Bootstrap::context();
$case = new Cases();
//select cases for this Process, ordered by APP_NUMBER
@@ -5002,7 +5003,8 @@ class WorkspaceTools
$context["message"] = $e->getMessage();
$context["tableName"] = $tableName;
$context["appUid"] = $application->APP_UID;
Bootstrap::registerMonolog("sqlExecution", 500, "Sql Execution", $context, $context["workspace"], "processmaker.log");
$message = 'Sql Execution';
Log::channel(':sqlExecution')->critical($message, Bootstrap::context($context));
}
unset($obj);
}
@@ -5020,7 +5022,8 @@ class WorkspaceTools
$context["message"] = $e->getMessage();
$context["tableName"] = $tableName;
$context["appUid"] = $application->APP_UID;
Bootstrap::registerMonolog("sqlExecution", 500, "Sql Execution", $context, $context["workspace"], "processmaker.log");
$message = 'Sql Execution';
Log::channel(':sqlExecution')->critical($message, Bootstrap::context($context));
}
unset($obj);
}

View File

@@ -28,6 +28,7 @@
//
// License: LGPL, see LICENSE
////////////////////////////////////////////////////
use Illuminate\Support\Facades\Log;
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
@@ -242,9 +243,6 @@ function literalDate ($date, $lang = 'en')
*/
function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter = array())
{
$sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined";
$aContext = \Bootstrap::getDefaultContextLog();
// This means the DBConnectionUID is not loaded yet, so we'll force DbConnections::loadAdditionalConnections
if (is_null(config('database.connections.' . $DBConnectionUID . '.driver'))) {
// Force to load the external connections
@@ -356,17 +354,21 @@ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
}
}
//Logger
$aContext['action'] = 'execute-query';
$aContext['sql'] = $SqlStatement;
\Bootstrap::registerMonolog('sqlExecution', 200, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
$message = 'Sql Execution';
$context = [
'action' => 'execute-query',
'sql' => $SqlStatement
];
Log::channel(':sqlExecution')->info($message, Bootstrap::context($context));
return $result;
} catch (SQLException $sqle) {
//Logger
$aContext['action'] = 'execute-query';
$aContext['SQLExceptionMessage'] = $sqle->getMessage();
\Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
$message = 'Sql Execution';
$context = [
'action' => 'execute-query',
'SQLExceptionMessage' => $sqle->getMessage()
];
Log::channel(':sqlExecution')->error($message, Bootstrap::context($context));
$con->rollback();
throw $sqle;
}

View File

@@ -2,6 +2,7 @@
use App\Jobs\GenerateReportTable;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use ProcessMaker\Core\JobsManager;
use ProcessMaker\Core\System;
use ProcessMaker\Model\Application;
@@ -1033,10 +1034,9 @@ class AdditionalTables extends BaseAdditionalTables
if ($externalResultSet->next()) {
$stringCount = $externalResultSet->getInt(1);
}
} catch (Exception $externalException) {
$context = Bootstrap::getDefaultContextLog();
$context = array_merge($context, $row);
Bootstrap::registerMonolog("additional tables", 400, $externalException->getMessage(), $context);
} catch (Exception $e) {
$message = $e->getMessage();
Log::channel(':additional tables')->error($message, Bootstrap::context($row));
}
}
}

View File

@@ -2,6 +2,8 @@
require_once 'classes/model/om/BaseAppAssignSelfServiceValueGroup.php';
use Illuminate\Support\Facades\Log;
/**
* Skeleton subclass for representing a row from the 'APP_ASSIGN_SELF_SERVICE_VALUE_GROUP' table.
* You should add additional methods to this class to meet the
@@ -48,10 +50,12 @@ class AppAssignSelfServiceValueGroup extends BaseAppAssignSelfServiceValueGroup
{
$object = $this->getTypeUserOrGroup($id);
if ($object->id === -1) {
$dataLog = Bootstrap::getDefaultContextLog();
$dataLog['ASSIGNEE_ID'] = $id;
$dataLog['ASSIGNEE_TYPE'] = $object->type;
Bootstrap::registerMonolog('AssignSelfServiceValue', 300, 'Invalid identifier value for Assign Self Service Value', $dataLog, $dataLog['workspace'], 'processmaker.log');
$message = 'Invalid identifier value for Assign Self Service Value';
$context = [
'ASSIGNEE_ID' => $id,
'ASSIGNEE_TYPE' => $object->type
];
Log::channel(':AssignSelfServiceValue')->warning($message, Bootstrap::context($context));
} else {
$sql = "INSERT INTO "
. AppAssignSelfServiceValueGroupPeer::TABLE_NAME