Merged in bugfix/PMCORE-1335 (pull request #7332)
PMCORE-1335 ProcessMaker core should be use the native Laravel log mechanism Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
commit
5e8d0a8f02
@@ -14,6 +14,7 @@ use EmailServerPeer;
|
||||
use Exception;
|
||||
use G;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use PhpImap\IncomingMail;
|
||||
use PhpImap\Mailbox;
|
||||
use PMLicensedFeatures;
|
||||
@@ -73,14 +74,34 @@ class ResponseReader
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog(
|
||||
$this->channel,
|
||||
$e->getCode() != 0 ? $e->getCode() : 300,
|
||||
$e->getMessage(),
|
||||
$this->case,
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
$message = $e->getMessage();
|
||||
$context = $this->case;
|
||||
switch ($e->getCode()) {
|
||||
case 100:
|
||||
Log::channel(':' . $this->channel)->debug($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 200:
|
||||
Log::channel(':' . $this->channel)->info($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 250:
|
||||
Log::channel(':' . $this->channel)->notice($message, Bootstrap::context($context));
|
||||
break;
|
||||
default://300
|
||||
Log::channel(':' . $this->channel)->warning($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 400:
|
||||
Log::channel(':' . $this->channel)->error($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 500:
|
||||
Log::channel(':' . $this->channel)->critical($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 550:
|
||||
Log::channel(':' . $this->channel)->alert($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 600:
|
||||
Log::channel(':' . $this->channel)->emergency($message, Bootstrap::context($context));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,14 +159,9 @@ class ResponseReader
|
||||
try {
|
||||
$dataEmail = G::json_decode(Crypt::decryptString($matches[1]), true);
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog(
|
||||
$this->channel,
|
||||
300,
|
||||
G::LoadTranslation('ID_ABE_RESPONSE_CANNOT_BE_IDENTIFIED'),
|
||||
[],
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
$message = G::LoadTranslation('ID_ABE_RESPONSE_CANNOT_BE_IDENTIFIED');
|
||||
$context = [];
|
||||
Log::channel(':' . $this->channel)->warning($message, Bootstrap::context($context));
|
||||
$mailbox->markMailAsRead($mailId);
|
||||
continue;
|
||||
}
|
||||
@@ -162,14 +178,9 @@ class ResponseReader
|
||||
throw (new Exception(G::LoadTranslation('ID_CASE_DELEGATION_ALREADY_CLOSED'), 400));
|
||||
}
|
||||
$this->processABE($this->case, $mail, $dataAbe);
|
||||
Bootstrap::registerMonolog(
|
||||
$this->channel,
|
||||
100, // DEBUG
|
||||
G::LoadTranslation('ID_ABE_LOG_PROCESSED_OK'),
|
||||
$this->case,
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
$message = G::LoadTranslation('ID_ABE_LOG_PROCESSED_OK');
|
||||
$context = $this->case;
|
||||
Log::channel(':' . $this->channel)->debug($message, Bootstrap::context($context));
|
||||
} catch (Exception $e) {
|
||||
$this->sendMessageError(
|
||||
$this->getMessageResponseError() ? $this->getMessageResponseError() : $e->getMessage(),
|
||||
@@ -177,14 +188,34 @@ class ResponseReader
|
||||
$mail,
|
||||
$emailSetup
|
||||
);
|
||||
Bootstrap::registerMonolog(
|
||||
$this->channel,
|
||||
$e->getCode() != 0 ? $e->getCode() : 400,
|
||||
$e->getMessage(),
|
||||
$this->case,
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
$message = $e->getMessage();
|
||||
$context = $this->case;
|
||||
switch ($e->getCode()) {
|
||||
case 100:
|
||||
Log::channel(':' . $this->channel)->debug($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 200:
|
||||
Log::channel(':' . $this->channel)->info($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 250:
|
||||
Log::channel(':' . $this->channel)->notice($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 300:
|
||||
Log::channel(':' . $this->channel)->warning($message, Bootstrap::context($context));
|
||||
break;
|
||||
default://400
|
||||
Log::channel(':' . $this->channel)->error($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 500:
|
||||
Log::channel(':' . $this->channel)->critical($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 550:
|
||||
Log::channel(':' . $this->channel)->alert($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 600:
|
||||
Log::channel(':' . $this->channel)->emergency($message, Bootstrap::context($context));
|
||||
break;
|
||||
}
|
||||
}
|
||||
$mailbox->markMailAsRead($mailId);
|
||||
}
|
||||
@@ -193,14 +224,34 @@ class ResponseReader
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog(
|
||||
$this->channel,
|
||||
$e->getCode() != 0 ? $e->getCode() : 500,
|
||||
$e->getMessage(),
|
||||
$this->case,
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
$message = $e->getMessage();
|
||||
$context = $this->case;
|
||||
switch ($e->getCode()) {
|
||||
case 100:
|
||||
Log::channel(':' . $this->channel)->debug($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 200:
|
||||
Log::channel(':' . $this->channel)->info($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 250:
|
||||
Log::channel(':' . $this->channel)->notice($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 300:
|
||||
Log::channel(':' . $this->channel)->warning($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 400:
|
||||
Log::channel(':' . $this->channel)->error($message, Bootstrap::context($context));
|
||||
break;
|
||||
default://500
|
||||
Log::channel(':' . $this->channel)->critical($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 550:
|
||||
Log::channel(':' . $this->channel)->alert($message, Bootstrap::context($context));
|
||||
break;
|
||||
case 600:
|
||||
Log::channel(':' . $this->channel)->emergency($message, Bootstrap::context($context));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,14 +300,9 @@ class ResponseReader
|
||||
$abeAbeResponsesInstance = new AbeResponses();
|
||||
$dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses);
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog(
|
||||
$this->channel,
|
||||
300,
|
||||
$e->getMessage(),
|
||||
$this->case,
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
$message = $e->getMessage();
|
||||
$context = $this->case;
|
||||
Log::channel(':' . $this->channel)->warning($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
ChangeLog::getChangeLog()
|
||||
@@ -297,14 +343,9 @@ class ResponseReader
|
||||
$abeAbeResponsesInstance = new AbeResponses();
|
||||
$abeAbeResponsesInstance->createOrUpdate($dataResponses);
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog(
|
||||
$this->channel,
|
||||
300,
|
||||
$e->getMessage(),
|
||||
$this->case,
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
$message = $e->getMessage();
|
||||
$context = $this->case;
|
||||
Log::channel(':' . $this->channel)->warning($message, Bootstrap::context($context));
|
||||
}
|
||||
$dataAbeRequests = loadAbeRequest($caseInfo['ABE_REQ_UID']);
|
||||
//Save Cases Notes
|
||||
|
||||
@@ -31,9 +31,9 @@ use Exception;
|
||||
use G;
|
||||
use Groups;
|
||||
use GroupUserPeer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use InputDocument;
|
||||
use InvalidIndexSearchTextException;
|
||||
use ListParticipatedLast;
|
||||
use PmDynaform;
|
||||
use PmTable;
|
||||
use ProcessMaker\BusinessModel\ProcessSupervisor as BmProcessSupervisor;
|
||||
@@ -3311,7 +3311,9 @@ class Cases
|
||||
}
|
||||
$arrayApplicationData['APP_DATA'][$key] = G::json_encode($files);
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog('DeleteFile', 400, $e->getMessage(), $value, config("system.workspace"), 'processmaker.log');
|
||||
$message = $e->getMessage();
|
||||
$context = $value;
|
||||
Log::channel(':DeleteFile')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
$flagDelete = true;
|
||||
@@ -4064,8 +4066,12 @@ class Cases
|
||||
->status(415)
|
||||
->message(G::LoadTranslation('ID_UPLOAD_INVALID_DOC_TYPE_FILE', [$inpDocTypeFile]))
|
||||
->log(function ($rule) {
|
||||
Bootstrap::registerMonologPhpUploadExecution('phpUpload', 250, $rule->getMessage(),
|
||||
$rule->getData()->filename);
|
||||
$message = $rule->getMessage();
|
||||
$context = [
|
||||
'filename' => $rule->getData()->filename,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpUpload')->notice($message, Bootstrap::context($context));
|
||||
});
|
||||
// Rule: maximum file size
|
||||
$validator->addRule()
|
||||
@@ -4084,8 +4090,12 @@ class Cases
|
||||
->message(G::LoadTranslation("ID_UPLOAD_INVALID_DOC_MAX_FILESIZE",
|
||||
[$inpDocMaxFileSize . $inpDocMaxFileSizeUnit]))
|
||||
->log(function ($rule) {
|
||||
Bootstrap::registerMonologPhpUploadExecution('phpUpload', 250, $rule->getMessage(),
|
||||
$rule->getData()->filename);
|
||||
$message = $rule->getMessage();
|
||||
$context = [
|
||||
'filename' => $rule->getData()->filename,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpUpload')->notice($message, Bootstrap::context($context));
|
||||
});
|
||||
$validator->validate();
|
||||
// We will to review if the validator has some error
|
||||
|
||||
@@ -10,6 +10,7 @@ use EmailEventPeer;
|
||||
use EmailServerPeer;
|
||||
use Exception;
|
||||
use G;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Util\Common;
|
||||
use Propel;
|
||||
use ResultSet;
|
||||
@@ -533,13 +534,12 @@ class EmailEvent
|
||||
WsBase::MESSAGE_TYPE_EMAIL_EVENT
|
||||
);
|
||||
} else {
|
||||
Bootstrap::registerMonolog(
|
||||
'EmailEventMailError',
|
||||
200,
|
||||
G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', [$eventUid, $prj_uid]),
|
||||
['eventUid' => $eventUid, 'prj_uid' => $prj_uid],
|
||||
config('system.workspace'),
|
||||
'processmaker.log');
|
||||
$message = G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', [$eventUid, $prj_uid]);
|
||||
$context = [
|
||||
'eventUid' => $eventUid,
|
||||
'prj_uid' => $prj_uid
|
||||
];
|
||||
Log::channel(':EmailEventMailError')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use AppMessage;
|
||||
@@ -6,6 +7,7 @@ use Bootstrap;
|
||||
use Exception;
|
||||
use G;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Model\AbeConfiguration;
|
||||
use ProcessMaker\Model\EmailEvent;
|
||||
@@ -856,12 +858,9 @@ class EmailServer
|
||||
'setAsDefaultConfiguration' => $arrayData["MESS_DEFAULT"]
|
||||
);
|
||||
$this->setContextLog($info);
|
||||
$this->syslog(
|
||||
'CreateEmailServer',
|
||||
200,
|
||||
'New email server was created',
|
||||
$this->getContextLog()
|
||||
);
|
||||
$message = 'New email server was created';
|
||||
$context = $this->getContextLog();
|
||||
Log::channel(':CreateEmailServer')->info($message, Bootstrap::context($context));
|
||||
return $this->getEmailServer($emailServerUid);
|
||||
} else {
|
||||
$msg = "";
|
||||
@@ -1036,13 +1035,9 @@ class EmailServer
|
||||
'setAsDefaultConfiguration' => $arrayData["MESS_DEFAULT"]
|
||||
);
|
||||
$this->setContextLog($info);
|
||||
$this->syslog(
|
||||
'UpdateEmailServer',
|
||||
200,
|
||||
'The email server was updated',
|
||||
$this->getContextLog()
|
||||
);
|
||||
|
||||
$message = 'The email server was updated';
|
||||
$context = $this->getContextLog();
|
||||
Log::channel(':UpdateEmailServer')->info($message, Bootstrap::context($context));
|
||||
return $arrayData;
|
||||
} else {
|
||||
$msg = "";
|
||||
@@ -1105,12 +1100,9 @@ class EmailServer
|
||||
'messUid' => $emailServerUid
|
||||
);
|
||||
$this->setContextLog($info);
|
||||
$this->syslog(
|
||||
'DeleteEmailServer',
|
||||
200,
|
||||
'The email server was deleted',
|
||||
$this->getContextLog()
|
||||
);
|
||||
$message = 'The email server was deleted';
|
||||
$context = $this->getContextLog();
|
||||
Log::channel(':DeleteEmailServer')->info($message, Bootstrap::context($context));
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -1419,31 +1411,5 @@ class EmailServer
|
||||
return $rsCriteria->getRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Logging information related to the email server
|
||||
* When the user create, update, delete the email server
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
private function syslog(
|
||||
$channel,
|
||||
$level,
|
||||
$message,
|
||||
$context = array()
|
||||
)
|
||||
{
|
||||
try {
|
||||
Bootstrap::registerMonolog($channel, $level, $message, $context, $context['workspace'], 'processmaker.log');
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ use database;
|
||||
use Exception;
|
||||
use G;
|
||||
use GulliverBasePeer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use InputDocument;
|
||||
use PmLicenseManager;
|
||||
use PMmemcached;
|
||||
@@ -348,9 +349,12 @@ class Light
|
||||
$response['caseNumber'] = $aData['CASE_NUMBER'];
|
||||
|
||||
//Log
|
||||
Bootstrap::registerMonolog('MobileCreateCase', 200, "Create case",
|
||||
['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], config("system.workspace"),
|
||||
'processmaker.log');
|
||||
$message = 'Create case';
|
||||
$context = [
|
||||
'application_uid' => $aData['APPLICATION'],
|
||||
'usr_uid' => $userId
|
||||
];
|
||||
Log::channel(':MobileCreateCase')->info($message, Bootstrap::context($context));
|
||||
} catch (Exception $e) {
|
||||
$response['status'] = 'failure';
|
||||
$response['message'] = $e->getMessage();
|
||||
@@ -624,9 +628,12 @@ class Light
|
||||
}
|
||||
|
||||
//Log
|
||||
Bootstrap::registerMonolog('MobileRouteCase', 200, 'Route case',
|
||||
['application_uid' => $applicationUid, 'usr_uid' => $userUid], config("system.workspace"),
|
||||
'processmaker.log');
|
||||
$message = 'Route case';
|
||||
$context = [
|
||||
'application_uid' => $applicationUid,
|
||||
'usr_uid' => $userUid
|
||||
];
|
||||
Log::channel(':MobileRouteCase')->info($message, Bootstrap::context($context));
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -1128,7 +1135,12 @@ class Light
|
||||
->status(415)
|
||||
->message(G::LoadTranslation('ID_UPLOAD_INVALID_DOC_TYPE_FILE', [$inpDocTypeFile]))
|
||||
->log(function($rule) {
|
||||
Bootstrap::registerMonologPhpUploadExecution('phpUpload', 250, $rule->getMessage(), $rule->getData()->filename);
|
||||
$message = $rule->getMessage();
|
||||
$context = [
|
||||
'filename' => $rule->getData()->filename,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpUpload')->notice($message, Bootstrap::context($context));
|
||||
});
|
||||
|
||||
//rule: maximum file size
|
||||
@@ -1146,7 +1158,12 @@ class Light
|
||||
->status(413)
|
||||
->message(G::LoadTranslation("ID_UPLOAD_INVALID_DOC_MAX_FILESIZE", [$inpDocMaxFilesize . $inpDocMaxFilesizeUnit]))
|
||||
->log(function($rule) {
|
||||
Bootstrap::registerMonologPhpUploadExecution('phpUpload', 250, $rule->getMessage(), $rule->getData()->filename);
|
||||
$message = $rule->getMessage();
|
||||
$context = [
|
||||
'filename' => $rule->getData()->filename,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpUpload')->notice($message, Bootstrap::context($context));
|
||||
});
|
||||
$validator->validate();
|
||||
if ($validator->fails()) {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use Bootstrap;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class MessageApplication
|
||||
{
|
||||
private $arrayFieldNameForException = array(
|
||||
@@ -446,12 +450,9 @@ class MessageApplication
|
||||
,'evnUid' => $value['EVN_UID']
|
||||
,'evnName' => $value['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,"Case #$appNumber created"
|
||||
,'CREATED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Case #$appNumber created";
|
||||
$context = $aInfo;
|
||||
Log::channel(':MessageEventCron')->info($message, Bootstrap::context($context));
|
||||
|
||||
$result = $ws->derivateCase($messageEventDefinitionUserUid, $applicationUid, 1);
|
||||
$arrayResult = \G::json_decode(\G::json_encode($result), true);
|
||||
@@ -469,12 +470,9 @@ class MessageApplication
|
||||
,'evnUid' => $value['EVN_UID']
|
||||
,'evnName' => $value['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,"Case #$appNumber routed"
|
||||
,'ROUTED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Case #$appNumber routed";
|
||||
$context = $aInfo;
|
||||
Log::channel(':MessageEventCron')->info($message, Bootstrap::context($context));
|
||||
} else {
|
||||
$aInfo = array(
|
||||
'ip' => \G::getIpAddress()
|
||||
@@ -488,12 +486,9 @@ class MessageApplication
|
||||
,'evnUid' => $value['EVN_UID']
|
||||
,'evnName' => $value['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
500
|
||||
,"Failed case #$appNumber. " . $arrayResult["message"]
|
||||
,'ROUTED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Failed case #$appNumber. " . $arrayResult["message"];
|
||||
$context = $aInfo;
|
||||
Log::channel(':MessageEventCron')->critical($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$flagCatched = true;
|
||||
@@ -511,12 +506,9 @@ class MessageApplication
|
||||
,'evnUid' => $value['EVN_UID']
|
||||
,'evnName' => $value['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
500
|
||||
,"Failed case #$appNumber. " . $arrayResult["message"]
|
||||
,'CREATED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Failed case #$appNumber. " . $arrayResult["message"];
|
||||
$context = $aInfo;
|
||||
Log::channel(':MessageEventCron')->critical($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -567,12 +559,9 @@ class MessageApplication
|
||||
,'evnUid' => $value['EVN_UID']
|
||||
,'evnName' => $value['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,"Case #$appNumber routed "
|
||||
,'ROUTED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Case #$appNumber routed ";
|
||||
$context = $aInfo;
|
||||
Log::channel(':MessageEventCron')->info($message, Bootstrap::context($context));
|
||||
} else {
|
||||
$aInfo = array(
|
||||
'ip' => \G::getIpAddress()
|
||||
@@ -587,12 +576,9 @@ class MessageApplication
|
||||
,'evnUid' => $value['EVN_UID']
|
||||
,'evnName' => $value['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
500
|
||||
,"Failed case #$appNumber. " . $arrayResult["message"]
|
||||
,'ROUTED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Failed case #$appNumber. " . $arrayResult["message"];
|
||||
$context = $aInfo;
|
||||
Log::channel(':MessageEventCron')->critical($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$flagCatched = true;
|
||||
@@ -626,26 +612,15 @@ class MessageApplication
|
||||
$common->frontEndShow("TEXT", "Total cases started: " . $counterStartMessageEvent);
|
||||
$common->frontEndShow("TEXT", "Total cases continued: " . $counterIntermediateCatchMessageEvent);
|
||||
$common->frontEndShow("TEXT", "Total Message-Events pending: " . ($totalMessageEvent - ($counterStartMessageEvent + $counterIntermediateCatchMessageEvent)));
|
||||
$this->syslog(
|
||||
200
|
||||
,'Total Message-Events unread '. $totalMessageEvent
|
||||
,'RESUME'//Action
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'Total cases started '. $counterStartMessageEvent
|
||||
,'RESUME'//Action
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'Total cases continued '. $counterIntermediateCatchMessageEvent
|
||||
,'RESUME'//Action
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'Total Message-Events pending '. ($totalMessageEvent - ($counterStartMessageEvent + $counterIntermediateCatchMessageEvent))
|
||||
,'RESUME'//Action
|
||||
);
|
||||
$context = [];
|
||||
$message = 'Total Message-Events unread ' . $totalMessageEvent;
|
||||
Log::channel(':MessageEventCron')->info($message, Bootstrap::context($context));
|
||||
$message = 'Total cases started ' . $counterStartMessageEvent;
|
||||
Log::channel(':MessageEventCron')->info($message, Bootstrap::context($context));
|
||||
$message = 'Total cases continued ' . $counterIntermediateCatchMessageEvent;
|
||||
Log::channel(':MessageEventCron')->info($message, Bootstrap::context($context));
|
||||
$message = 'Total Message-Events pending ' . ($totalMessageEvent - ($counterStartMessageEvent + $counterIntermediateCatchMessageEvent));
|
||||
Log::channel(':MessageEventCron')->info($message, Bootstrap::context($context));
|
||||
|
||||
$common->frontEndShow("END");
|
||||
} catch (\Exception $e) {
|
||||
@@ -653,39 +628,4 @@ class MessageApplication
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Syslog register the information in Monolog Class
|
||||
*
|
||||
* @param int $level DEBUG=100 INFO=200 NOTICE=250 WARNING=300 ERROR=400 CRITICAL=500
|
||||
* @param string $message
|
||||
* @param string $ipClient for Context information
|
||||
* @param string $action for Context information
|
||||
* @param string $timeZone for Context information
|
||||
* @param string $workspace for Context information
|
||||
* @param string $usrUid for Context information
|
||||
* @param string $proUid for Context information
|
||||
* @param string $tasUid for Context information
|
||||
* @param string $appUid for Context information
|
||||
* @param string $delIndex for Context information
|
||||
* @param string $stepUid for Context information
|
||||
* @param string $triUid for Context information
|
||||
* @param string $outDocUid for Context information
|
||||
* @param string $inpDocUid for Context information
|
||||
* @param string $url for Context information
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
private function syslog(
|
||||
$level,
|
||||
$message,
|
||||
$action='',
|
||||
$aContext = array()
|
||||
)
|
||||
{
|
||||
try {
|
||||
\Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, config("system.workspace"), 'processmaker.log');
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use Bootstrap;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class TimerEvent
|
||||
{
|
||||
private $arrayFieldDefinition = array(
|
||||
@@ -1162,42 +1166,6 @@ class TimerEvent
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Syslog register the information in Monolog Class
|
||||
*
|
||||
* @param int $level DEBUG=100 INFO=200 NOTICE=250 WARNING=300 ERROR=400 CRITICAL=500
|
||||
* @param string $message
|
||||
* @param string $ipClient for Context information
|
||||
* @param string $action for Context information
|
||||
* @param string $timeZone for Context information
|
||||
* @param string $workspace for Context information
|
||||
* @param string $usrUid for Context information
|
||||
* @param string $proUid for Context information
|
||||
* @param string $tasUid for Context information
|
||||
* @param string $appUid for Context information
|
||||
* @param string $delIndex for Context information
|
||||
* @param string $stepUid for Context information
|
||||
* @param string $triUid for Context information
|
||||
* @param string $outDocUid for Context information
|
||||
* @param string $inpDocUid for Context information
|
||||
* @param string $url for Context information
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
private function syslog(
|
||||
$level,
|
||||
$message,
|
||||
$action='',
|
||||
$aContext = array()
|
||||
)
|
||||
{
|
||||
try {
|
||||
\Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, config("system.workspace"), 'processmaker.log');
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start/Continue case by Timer-Event
|
||||
*
|
||||
@@ -1237,12 +1205,9 @@ class TimerEvent
|
||||
,'timeZone' => $datetime
|
||||
,'workspace'=> $sysSys
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'Start new cases'
|
||||
,'START-NEW-CASES'
|
||||
,$aInfo
|
||||
);
|
||||
$message = 'Start new cases';
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
|
||||
//Query
|
||||
$criteria = $this->getTimerEventCriteria();
|
||||
@@ -1399,12 +1364,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,"Case #$applicationNumber created"
|
||||
,'CREATED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Case #$applicationNumber created";
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
|
||||
//Derivate new case
|
||||
$result = $ws->derivateCase("", $applicationUid, 1);
|
||||
@@ -1428,12 +1390,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,"Case #$applicationNumber routed"
|
||||
,'ROUTED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Case #$applicationNumber routed";
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
} else {
|
||||
$common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]);
|
||||
|
||||
@@ -1451,12 +1410,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
500
|
||||
,"Failed case #$applicationNumber. " . $arrayResult["message"]
|
||||
,'ROUTED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Failed case #$applicationNumber. " . $arrayResult["message"];
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->critical($message, Bootstrap::context($context));
|
||||
}
|
||||
} else {
|
||||
$common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]);
|
||||
@@ -1472,12 +1428,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
500
|
||||
,"Failed case #$applicationNumber. " . $arrayResult["message"]
|
||||
,'CREATED-NEW-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Failed case #$applicationNumber. " . $arrayResult["message"];
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->critical($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$flagRecord = true;
|
||||
@@ -1491,15 +1444,12 @@ class TimerEvent
|
||||
$aInfo = array(
|
||||
'ip' => \G::getIpAddress()
|
||||
,'action' => $action
|
||||
,'TimeZone' => $datetime
|
||||
,'timeZone' => $datetime
|
||||
,'workspace'=> $sysSys
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'Not exists any record to start a new case'
|
||||
,'NO-RECORDS'
|
||||
,$aInfo
|
||||
);
|
||||
$message = 'Not exists any record to start a new case';
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$common->frontEndShow("END");
|
||||
@@ -1510,15 +1460,12 @@ class TimerEvent
|
||||
$aInfo = array(
|
||||
'ip' => \G::getIpAddress()
|
||||
,'action' => $action
|
||||
,'TimeZone' => $datetime
|
||||
,'timeZone' => $datetime
|
||||
,'workspace'=> $sysSys
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'Start continue the cases'
|
||||
,'START-CONTINUE-CASES'
|
||||
,$aInfo
|
||||
);
|
||||
$message = 'Start continue the cases';
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
|
||||
//Query
|
||||
$criteriaMain = $this->getTimerEventCriteria();
|
||||
@@ -1708,12 +1655,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,"Case #$applicationNumber continued"
|
||||
,'CONTINUED-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Case #$applicationNumber continued";
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
} else {
|
||||
$common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]);
|
||||
|
||||
@@ -1730,12 +1674,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
500
|
||||
,"Failed case #$applicationUid. " . $arrayResult["message"]
|
||||
,'CONTINUED-CASE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = "Failed case #$applicationUid. " . $arrayResult["message"];
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->critical($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$flagRecord = true;
|
||||
@@ -1754,12 +1695,9 @@ class TimerEvent
|
||||
,'evnUid' => $row['EVN_UID']
|
||||
,'evnName' => $row['EVN_NAME']
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'Continue date '. $continueCaseDate
|
||||
,'INVALID-CONTINUE-DATE'
|
||||
,$aInfo
|
||||
);
|
||||
$message = 'Invalid date to continue ' . $continueCaseDate;
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$counter++;
|
||||
@@ -1777,15 +1715,12 @@ class TimerEvent
|
||||
$aInfo = array(
|
||||
'ip' => \G::getIpAddress()
|
||||
,'action' => $action
|
||||
,'TimeZone' => $datetime
|
||||
,'timeZone' => $datetime
|
||||
,'workspace'=> $sysSys
|
||||
);
|
||||
$this->syslog(
|
||||
200
|
||||
,'No existing records to continue a case'
|
||||
,'NO-RECORDS'
|
||||
,$aInfo
|
||||
);
|
||||
$message = 'No existing records to continue a case';
|
||||
$context = $aInfo;
|
||||
Log::channel(':TimerEventCron')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$common->frontEndShow("END");
|
||||
|
||||
Reference in New Issue
Block a user