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
@@ -6,6 +6,7 @@ use Bootstrap;
|
||||
use Configurations;
|
||||
use Exception;
|
||||
use G;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\System;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
@@ -273,7 +274,7 @@ class AuditLog
|
||||
foreach ($lines as $line) {
|
||||
if ($start <= $count && count($result) < $limit) {
|
||||
/**
|
||||
* processmaker/gulliver/system/class.monologProvider.php
|
||||
* \App\Logging\CustomizeFormatter
|
||||
* "<%level%> %datetime% %channel% %level_name%: %message% %context% %extra%\n"
|
||||
*/
|
||||
$data = $this->lineToObject($line, '/([A-Z][a-z][a-z]\s{1,2}\d{1,2}\s\d{2}[:]\d{2}[:]\d{2})\s([\w][\w\d\.@-]*)\s(.*)$/');
|
||||
@@ -288,30 +289,6 @@ class AuditLog
|
||||
return [$count, $result];
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an action for Audit Log.
|
||||
*
|
||||
* @param string $action
|
||||
* @param string $value
|
||||
*/
|
||||
public function register($action, $value = '')
|
||||
{
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context['usrUid'] = $this->userLogged;
|
||||
$context['usrName'] = $this->userFullname;
|
||||
$context['action'] = $action;
|
||||
$context['description'] = $value;
|
||||
Bootstrap::registerMonolog(
|
||||
$action,
|
||||
200,
|
||||
$action,
|
||||
$context,
|
||||
$context['workspace'],
|
||||
'audit.log',
|
||||
self::READ_LOGGING_LEVEL
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Audit Log files.
|
||||
*
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -49,6 +49,7 @@ class JobsManager
|
||||
'__SYSTEM_UTC_TIME_ZONE__',
|
||||
'USER_LOGGED',
|
||||
'USR_USERNAME',
|
||||
'USR_TIME_ZONE',
|
||||
'APPLICATION',
|
||||
'INDEX',
|
||||
'PROCESS',
|
||||
@@ -126,6 +127,11 @@ class JobsManager
|
||||
'constants' => $constants['user'],
|
||||
'session' => $session,
|
||||
'server' => $_SERVER,
|
||||
'phpEnv' => [
|
||||
'HTTP_CLIENT_IP' => getenv('HTTP_CLIENT_IP'),
|
||||
'HTTP_X_FORWARDED_FOR' => getenv('HTTP_X_FORWARDED_FOR'),
|
||||
'REMOTE_ADDR' => getenv('REMOTE_ADDR'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -148,6 +154,13 @@ class JobsManager
|
||||
|
||||
Propel::close();
|
||||
Propel::init(PATH_CONFIG . "databases.php");
|
||||
|
||||
foreach ($environment['phpEnv'] as $key => $value) {
|
||||
if (empty($value)) {
|
||||
continue;
|
||||
}
|
||||
putenv("{$key}={$value}");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,12 +208,12 @@ class JobsManager
|
||||
$this->recoverDataSnapshot($environment);
|
||||
$callback($environment);
|
||||
} catch (Exception $e) {
|
||||
Log::error($e->getMessage() . ": " . $e->getTraceAsString());
|
||||
$message = $e->getMessage();
|
||||
$context = [
|
||||
"trace" => $e->getTraceAsString(),
|
||||
"workspace" => $environment["constants"]["SYS_SYS"]
|
||||
];
|
||||
Bootstrap::registerMonolog("queue:work", 400, $e->getMessage(), $context, "");
|
||||
Log::channel(':queue-work')->error($message, Bootstrap::context($context));
|
||||
throw $e;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ use G;
|
||||
use Google_Client;
|
||||
use Google_Service_Gmail;
|
||||
use Google_Service_Gmail_Message;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use PHPMailerOAuth;
|
||||
use ProcessMaker\BusinessModel\EmailServer;
|
||||
use ProcessMaker\Core\System;
|
||||
@@ -464,8 +465,6 @@ class GmailOAuth
|
||||
*/
|
||||
public function saveIntoStandardLogs(string $status = "")
|
||||
{
|
||||
$channel = "Test Email Servers Configuration";
|
||||
$severity = 200; //INFO
|
||||
$message = "Email Server test has been sent";
|
||||
$context = [
|
||||
"emailServerUid" => $this->emailServerUid,
|
||||
@@ -476,7 +475,6 @@ class GmailOAuth
|
||||
"senderName" => $this->senderName,
|
||||
"status" => $status
|
||||
];
|
||||
$workspace = config("system.workspace");
|
||||
Bootstrap::registerMonolog($channel, $severity, $message, $context, $workspace);
|
||||
Log::channel(':GmailOAuth')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Project;
|
||||
|
||||
use BasePeer;
|
||||
@@ -29,6 +30,7 @@ use BpmnProcessPeer as ProcessPeer;
|
||||
use Criteria as Criteria;
|
||||
use Exception;
|
||||
use G;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ResultSet as ResultSet;
|
||||
use ProcessMaker\Util\Common;
|
||||
use ProcessMaker\Exception\ProjectNotFound;
|
||||
@@ -278,13 +280,9 @@ class Bpmn extends Handler
|
||||
}
|
||||
$me = new self();
|
||||
$me->setContextLog($response);
|
||||
$me->syslog(
|
||||
'DoBulkDelete',
|
||||
200,
|
||||
'Do bulk delete',
|
||||
$me->getContextLog()
|
||||
);
|
||||
|
||||
$message = 'Do bulk delete';
|
||||
$context = $me->getContextLog();
|
||||
Log::channel(':DoBulkDelete')->info($message, Bootstrap::context($context));
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -1676,28 +1674,4 @@ class Bpmn extends Handler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logging information related to project
|
||||
* When the user doDeleteBulk
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Util;
|
||||
|
||||
use Bootstrap;
|
||||
use G;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Constructs the name of the variable starting from a string representing the
|
||||
@@ -21,11 +24,12 @@ class ParseSoapVariableName
|
||||
public function buildVariableName(&$field, $name, $value)
|
||||
{
|
||||
if (!$this->isValidVariableName($name)) {
|
||||
$context = \Bootstrap::getDefaultContextLog();
|
||||
$context['action'] = 'soap2';
|
||||
$context['exception'] = 'Invalid param: '.G::json_encode($name);
|
||||
\Bootstrap::registerMonolog('soap2', 400, 'NewCase', $context, $context['workspace'], 'processmaker.log');
|
||||
|
||||
$message = 'NewCase';
|
||||
$context = [
|
||||
'action' => 'soap2',
|
||||
'exception' => 'Invalid param: '.G::json_encode($name)
|
||||
];
|
||||
Log::channel(':soap2')->error($message, Bootstrap::context($context));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use Bootstrap;
|
||||
use G;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Monolog\Logger;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Services\OAuth2\Server;
|
||||
use ProcessMaker\Util\PhpShorthandByte;
|
||||
@@ -62,18 +62,12 @@ class ValidationUploadedFiles
|
||||
->status(550)
|
||||
->message(G::LoadTranslation('ID_THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED'))
|
||||
->log(function($rule) {
|
||||
/**
|
||||
* Levels supported by MonologProvider is:
|
||||
* 100 "DEBUG"
|
||||
* 200 "INFO"
|
||||
* 250 "NOTICE"
|
||||
* 300 "WARNING"
|
||||
* 400 "ERROR"
|
||||
* 500 "CRITICAL"
|
||||
* 550 "ALERT"
|
||||
* 600 "EMERGENCY"
|
||||
*/
|
||||
Bootstrap::registerMonologPhpUploadExecution('phpUpload', 550, $rule->getMessage(), $rule->getData()->filename);
|
||||
$message = $rule->getMessage();
|
||||
$context = [
|
||||
'filename' => $rule->getData()->filename,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpUpload')->alert($message, Bootstrap::context($context));
|
||||
});
|
||||
|
||||
//rule: upload_attempts_limit_per_user
|
||||
@@ -100,18 +94,12 @@ class ValidationUploadedFiles
|
||||
->status(429)
|
||||
->message(G::LoadTranslation('ID_TOO_MANY_REQUESTS'))
|
||||
->log(function($rule) {
|
||||
/**
|
||||
* Levels supported by MonologProvider is:
|
||||
* 100 "DEBUG"
|
||||
* 200 "INFO"
|
||||
* 250 "NOTICE"
|
||||
* 300 "WARNING"
|
||||
* 400 "ERROR"
|
||||
* 500 "CRITICAL"
|
||||
* 550 "ALERT"
|
||||
* 600 "EMERGENCY"
|
||||
*/
|
||||
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: mimeType
|
||||
@@ -160,18 +148,12 @@ class ValidationUploadedFiles
|
||||
->status(415)
|
||||
->message(G::LoadTranslation('ID_THE_MIMETYPE_EXTENSION_ERROR'))
|
||||
->log(function($rule) {
|
||||
/**
|
||||
* Levels supported by MonologProvider is:
|
||||
* 100 "DEBUG"
|
||||
* 200 "INFO"
|
||||
* 250 "NOTICE"
|
||||
* 300 "WARNING"
|
||||
* 400 "ERROR"
|
||||
* 500 "CRITICAL"
|
||||
* 550 "ALERT"
|
||||
* 600 "EMERGENCY"
|
||||
*/
|
||||
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));
|
||||
});
|
||||
|
||||
return $validator->validate();
|
||||
@@ -285,7 +267,12 @@ class ValidationUploadedFiles
|
||||
})
|
||||
->status(400)
|
||||
->log(function($rule) {
|
||||
Bootstrap::registerMonologPhpUploadExecution('phpUpload', 400, $rule->getMessage(), "");
|
||||
$message = $rule->getMessage();
|
||||
$context = [
|
||||
'filename' => "",
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpUpload')->error($message, Bootstrap::context($context));
|
||||
});
|
||||
|
||||
return $validator->validate();
|
||||
@@ -315,9 +302,14 @@ class ValidationUploadedFiles
|
||||
}
|
||||
return self::VALID;
|
||||
})
|
||||
->status(Logger::ERROR)
|
||||
->status(400)
|
||||
->log(function($rule) {
|
||||
Bootstrap::registerMonologPhpUploadExecution('phpUpload', Logger::ERROR, $rule->getMessage(), $rule->getData()->filename);
|
||||
$message = $rule->getMessage();
|
||||
$context = [
|
||||
'filename' => $rule->getData()->filename,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpUpload')->error($message, Bootstrap::context($context));
|
||||
});
|
||||
|
||||
//rule: extensions
|
||||
@@ -334,9 +326,14 @@ class ValidationUploadedFiles
|
||||
}
|
||||
return self::VALID;
|
||||
})
|
||||
->status(Logger::ERROR)
|
||||
->status(400)
|
||||
->log(function($rule) {
|
||||
Bootstrap::registerMonologPhpUploadExecution('phpUpload', Logger::ERROR, $rule->getMessage(), $rule->getData()->filename);
|
||||
$message = $rule->getMessage();
|
||||
$context = [
|
||||
'filename' => $rule->getData()->filename,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpUpload')->error($message, Bootstrap::context($context));
|
||||
});
|
||||
|
||||
//rule: file size
|
||||
@@ -354,9 +351,14 @@ class ValidationUploadedFiles
|
||||
}
|
||||
return self::VALID;
|
||||
})
|
||||
->status(Logger::ERROR)
|
||||
->status(400)
|
||||
->log(function($rule) {
|
||||
Bootstrap::registerMonologPhpUploadExecution('phpUpload', Logger::ERROR, $rule->getMessage(), $rule->getData()->filename);
|
||||
$message = $rule->getMessage();
|
||||
$context = [
|
||||
'filename' => $rule->getData()->filename,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpUpload')->error($message, Bootstrap::context($context));
|
||||
});
|
||||
|
||||
return $validator->validate();
|
||||
|
||||
Reference in New Issue
Block a user