From 57dee4419323e2c9776427b20e0051954bd553ba Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Thu, 14 Jul 2016 16:43:56 -0400 Subject: [PATCH] HOR-779 , timerevent and messageEvent add message HOR-779 I used singleton observations . json . I fixed some observations HOR-779 --- composer.json | 4 +- composer.lock | 135 +++++++++++++- gulliver/system/class.bootstrap.php | 21 +++ gulliver/system/class.monologProvider.php | 118 +++++++++++++ workflow/engine/bin/cron_single.php | 4 + .../BusinessModel/MessageApplication.php | 165 ++++++++++++++++- .../ProcessMaker/BusinessModel/TimerEvent.php | 166 +++++++++++++++++- workflow/public_html/sysGeneric.php | 3 + 8 files changed, 602 insertions(+), 14 deletions(-) create mode 100644 gulliver/system/class.monologProvider.php diff --git a/composer.json b/composer.json index 30b6fea5a..7fced9261 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,9 @@ "colosa/MichelangeloFE": "3.1-dev", "colosa/pmdynaform": "3.1-dev", "google/apiclient": "1.1.6", - "dapphp/securimage": "^3.6" + "dapphp/securimage": "^3.6", + "psr/log":"1.0.0", + "monolog/monolog": "1.19.0" }, "require-dev": { "guzzle/guzzle": "~3.1.1", diff --git a/composer.lock b/composer.lock index 68c03aa28..6317e7c3b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "9256746135622162ab9868a31a9f79c0", - "content-hash": "e3a05d57374607de60f795f5b707cd16", + "hash": "e94e04e50eb74bdfd3dfedcb1af4e6d0", + "content-hash": "f0b89bffcea74fc73605464d3f0ca520", "packages": [ { "name": "bshaffer/oauth2-server-php", @@ -269,6 +269,122 @@ "server" ], "time": "2015-08-04 07:52:49" + }, + { + "name": "monolog/monolog", + "version": "1.19.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/5f56ed5212dc509c8dc8caeba2715732abb32dbf", + "reference": "5f56ed5212dc509c8dc8caeba2715732abb32dbf", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "raven/raven": "^0.13", + "ruflin/elastica": ">=0.90 <3.0", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "raven/raven": "Allow sending log messages to a Sentry server", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "http://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-04-12 18:29:35" + }, + { + "name": "psr/log", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Psr\\Log\\": "" + } + }, + "notification-url": "http://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2012-12-21 11:40:51" } ], "packages-dev": [ @@ -490,6 +606,7 @@ "rest", "web service" ], + "abandoned": "guzzlehttp/guzzle", "time": "2013-01-28 00:07:40" }, { @@ -527,7 +644,7 @@ "/Tests/" ] }, - "notification-url": "https://packagist.org/downloads/", + "notification-url": "http://packagist.org/downloads/", "license": [ "MIT" ], @@ -587,7 +704,7 @@ "/Tests/" ] }, - "notification-url": "https://packagist.org/downloads/", + "notification-url": "http://packagist.org/downloads/", "license": [ "MIT" ], @@ -650,7 +767,7 @@ "/Tests/" ] }, - "notification-url": "https://packagist.org/downloads/", + "notification-url": "http://packagist.org/downloads/", "license": [ "MIT" ], @@ -710,7 +827,7 @@ "/Tests/" ] }, - "notification-url": "https://packagist.org/downloads/", + "notification-url": "http://packagist.org/downloads/", "license": [ "MIT" ], @@ -759,7 +876,7 @@ "/Tests/" ] }, - "notification-url": "https://packagist.org/downloads/", + "notification-url": "http://packagist.org/downloads/", "license": [ "MIT" ], @@ -932,7 +1049,7 @@ "/Tests/" ] }, - "notification-url": "https://packagist.org/downloads/", + "notification-url": "http://packagist.org/downloads/", "license": [ "MIT" ], @@ -981,7 +1098,7 @@ "/Tests/" ] }, - "notification-url": "https://packagist.org/downloads/", + "notification-url": "http://packagist.org/downloads/", "license": [ "MIT" ], diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index ebb6450bd..2cb4ed477 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -97,6 +97,7 @@ class Bootstrap self::registerClass("PMException", PATH_GULLIVER . "class.pmException.php"); self::registerClass("Publisher", PATH_GULLIVER . "class.publisher.php"); self::registerClass("RBAC", PATH_GULLIVER . "class.rbac.php"); + self::registerClass("MonologProvider", PATH_GULLIVER . "class.monologProvider.php"); self::registerClass("RestClient", PATH_GULLIVER . "class.restClient.php"); self::registerClass("soapNtlm", PATH_GULLIVER . "class.soapNtlm.php"); self::registerClass("NTLMSoapClient", PATH_GULLIVER . "class.soapNtlm.php"); @@ -3011,5 +3012,25 @@ class Bootstrap } return $isIE; } + + /** + * Stores a message in the log file, if the file size exceeds + * + * @param string $channel + * @param string $message + * @param array $context + * @param string $file + * @param string $pathData + * @param string $ws workspace + * + * @return void + */ + public static function registerMonolog($channel, $level, $message, $context, $ws, $file = 'cron.log', $pathData = PATH_DATA) + { + $fileLog = $pathData .'sites'. PATH_SEP . $ws . PATH_SEP . 'log' . PATH_SEP . $file; + + $registerLogger = &MonologProvider::getSingleton($channel, $fileLog); + $registerLogger->addLog($level, $message, $context); + } } diff --git a/gulliver/system/class.monologProvider.php b/gulliver/system/class.monologProvider.php new file mode 100644 index 000000000..bd5eb4642 --- /dev/null +++ b/gulliver/system/class.monologProvider.php @@ -0,0 +1,118 @@ +. + * + */ + +class MonologProvider +{ + private static $instance = null; + public $aWorkspaces = null; + public $formatter; + public $streamRoutating; + public $registerLogger; + + //the default format "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"; + public $output = "<%level%> %datetime% %channel% %level_name%: %message% %context% %extra%\n"; + public $dateFormat = "M d H:i:s"; + public $numOfKeepFiles = 60; + + public function __construct ($channel, $fileLog) + { + //Set Formatter + $this->formatter = new Monolog\Formatter\LineFormatter($this->output, $this->dateFormat); + + //Set Routating Handler + $this->streamRoutating = new Monolog\Handler\RotatingFileHandler($fileLog, $this->numOfKeepFiles); + $this->streamRoutating->setFormatter($this->formatter); + + //Create the channel and register the Logger with StreamRoutating + $this->registerLogger = new Monolog\Logger($channel); + $this->registerLogger->pushProcessor(new Monolog\Processor\IntrospectionProcessor()); + $this->registerLogger->pushHandler($this->streamRoutating); + + } + + /** + * to get singleton instance + * + * @access public + * @return object + */ + public function getSingleton ($channel, $fileLog) + { + if (self::$instance == null) { + self::$instance = new MonologProvider($channel, $fileLog); + } else { + self::$instance->setConfig($channel, $fileLog); + } + return self::$instance; + } + + /** + * Set channel and fileLog + * + * @access public + * @return object + */ + public function setConfig ($channel, $fileLog) + { + //Set Routating Handler + $this->streamRoutating = new Monolog\Handler\RotatingFileHandler($fileLog, $this->numOfKeepFiles); + $this->streamRoutating->setFormatter($this->formatter); + + //Create the channel and register the Logger with StreamRoutating + $this->registerLogger = new Monolog\Logger($channel); + $this->registerLogger->pushProcessor(new Monolog\Processor\IntrospectionProcessor()); + $this->registerLogger->pushHandler($this->streamRoutating); + } + + /** + * to register log + * + * @access public + * @return void + */ + public function addLog ($level, $message, $context) + { + switch ($level) { + case 100://DEBUG + $this->registerLogger->addDebug($message, $context); + break; + case 200://INFO + $this->registerLogger->addInfo($message, $context); + break; + case 250://NOTICE + $this->registerLogger->addNotice($message, $context); + break; + case 300://WARNING + $this->registerLogger->addWarning($message, $context); + break; + case 400://ERROR + $this->registerLogger->addError($message, $context); + case 500://CRITICAL + $this->registerLogger->addCritical($message, $context); + break; + case 550://ALERT + $this->registerLogger->addAlert($message, $context); + case 600://EMERGENCY + $this->registerLogger->addEmergency($message, $context); + break; + default: + $this->registerLogger->addDebug($message, $context); + } + } +} \ No newline at end of file diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php index 61ea80b47..0cb222a62 100755 --- a/workflow/engine/bin/cron_single.php +++ b/workflow/engine/bin/cron_single.php @@ -143,6 +143,7 @@ try { Bootstrap::registerClass('SolrUpdateDocument', PATH_HOME . 'engine/classes/entities/SolrUpdateDocument.php'); Bootstrap::registerClass('Xml_Node', PATH_GULLIVER . 'class.xmlDocument.php'); Bootstrap::registerClass('wsResponse', PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.wsResponse.php'); + Bootstrap::initVendors(); /*----------------------------------********---------------------------------*/ Bootstrap::registerClass('dashboards', PATH_HOME . 'engine/classes/class.dashboards.php'); @@ -278,6 +279,9 @@ try { define('TIME_ZONE', ini_get('date.timezone')); + //Enable Monolog + Bootstrap::LoadSystem( 'monologProvider' ); + //Processing eprintln('Processing workspace: ' . $workspace, 'green'); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php b/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php index e5d0c8427..5674215cb 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php @@ -422,17 +422,67 @@ class MessageApplication //Start and derivate new Case $result = $ws->newCase($processUid, $messageEventDefinitionUserUid, $taskUid, $arrayVariable); - $arrayResult = json_decode(json_encode($result), true); + $arrayResult = \G::json_decode(\G::json_encode($result), true); if ($arrayResult["status_code"] == 0) { $applicationUid = $arrayResult["caseId"]; + $appUid = $arrayResult["caseId"]; + $appNumber = $arrayResult["caseNumber"]; + $this->syslog( + 200 + ,'Case created' + ,'CREATED-NEW-CASE' + ,''//timeZone + ,$messageEventDefinitionUserUid + ,$processUid + ,$taskUid + ,$appUid + ,$appNumber + ); $result = $ws->derivateCase($messageEventDefinitionUserUid, $applicationUid, 1); + $arrayResult = \G::json_decode(\G::json_encode($result), true); + if ($arrayResult["status_code"] == 0) { + $this->syslog( + 200 + ,'Case routed' + ,'ROUTED-NEW-CASE' + ,''//timeZone + ,$messageEventDefinitionUserUid + ,$processUid + ,$taskUid + ,$appUid + ,$appNumber + ,'1'//Del Index + ); + } else { + $this->syslog( + 500 + ,'Failed case routed '.$arrayResult["message"] + ,'ROUTED-NEW-CASE' + ,''//timeZone + ,$messageEventDefinitionUserUid + ,$processUid + ,$taskUid + ,$appUid + ,$appNumber + ); + } $flagCatched = true; //Counter $counterStartMessageEvent++; + } else { + $this->syslog( + 500 + ,'Failed case created '.$arrayResult["message"] + ,'CREATED-NEW-CASE' + ,''//timeZone + ,$messageEventDefinitionUserUid + ,$processUid + ,$taskUid + ); } } break; @@ -465,8 +515,37 @@ class MessageApplication $arrayApplicationData["APP_DATA"] = array_merge($arrayApplicationData["APP_DATA"], $arrayVariable); $arrayResult = $case->updateCase($applicationUid, $arrayApplicationData); + $appNumber = isset($arrayApplicationData["APP_DATA"]["APP_NUMBER"]) ? $arrayApplicationData["APP_DATA"]["APP_NUMBER"] : ''; $result = $ws->derivateCase($userUid, $applicationUid, $delIndex); + $arrayResult = \G::json_decode(\G::json_encode($result), true); + if ($arrayResult["status_code"] == 0) { + $this->syslog( + 200 + ,'Case routed' + ,'ROUTED-NEW-CASE' + ,''//timeZone + ,$userUid + ,$processUid + ,$taskUid + ,$applicationUid + ,$appNumber + ,$delIndex + ); + } else { + $this->syslog( + 500 + ,'Failed case routed' + ,'ROUTED-NEW-CASE' + ,''//timeZone + ,$userUid + ,$processUid + ,$taskUid + ,$applicationUid + ,$appNumber + ,$delIndex + ); + } $flagCatched = true; } @@ -497,11 +576,95 @@ 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 + ); $common->frontEndShow("END"); } catch (\Exception $e) { throw $e; } } + + /** + * 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='', + $timeZone='', + $usrUid='', + $proUid='', + $tasUid='', + $appUid='', + $appNumber='', + $delIndex='', + $stepUid='', + $triUid='', + $outDocUid='', + $inpDocUid='', + $url='' + ) + { + try { + $aContext = array( + 'ip' => \G::getIpAddress() + ,'action' => $action + ,'TimeZone' => $timeZone + ,'workspace'=> (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined" + ,'usrUid' => $usrUid + ,'proUid' => $proUid + ,'tasUid' => $tasUid + ,'appUid' => $appUid + ,'appNumber'=> $appNumber + ,'delIndex' => $delIndex + ,'stepUid' => $stepUid + ,'triUid' => $triUid + ,'outDocUid'=> $outDocUid + ,'inpDocUid'=> $inpDocUid + ,'url' => $url + ); + \Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, SYS_SYS, 'messageevent.log'); + } catch (\Exception $e) { + throw $e; + } + } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php index 4e8c0f8bb..de31ea93b 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php @@ -1153,6 +1153,70 @@ 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='', + $timeZone='', + $usrUid='', + $proUid='', + $tasUid='', + $appUid='', + $appNumber='', + $delIndex='', + $stepUid='', + $triUid='', + $outDocUid='', + $inpDocUid='', + $url='' + ) + { + try { + $aContext = array( + 'ip' => \G::getIpAddress() + ,'action' => $action + ,'TimeZone' => $timeZone + ,'workspace'=> (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined" + ,'usrUid' => $usrUid + ,'proUid' => $proUid + ,'tasUid' => $tasUid + ,'appUid' => $appUid + ,'appNumber'=> $appNumber + ,'delIndex' => $delIndex + ,'stepUid' => $stepUid + ,'triUid' => $triUid + ,'outDocUid'=> $outDocUid + ,'inpDocUid'=> $inpDocUid + ,'url' => $url + ); + \Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, SYS_SYS, 'timerevent.log'); + } catch (\Exception $e) { + throw $e; + } + } + /** * Start/Continue case by Timer-Event * @@ -1183,6 +1247,12 @@ class TimerEvent $common->frontEndShow("START"); $this->log("START-NEW-CASES", "Date \"$datetime (UTC +00:00)\": Start new cases"); + $this->syslog( + 200 + ,'Start new cases' + ,'START-NEW-CASES' + ,$datetime + ); //Query $criteria = $this->getTimerEventCriteria(); @@ -1317,7 +1387,7 @@ class TimerEvent //Start new case $result = $ws->newCase($arrayTimerEventData["PRJ_UID"], "", $taskUid, array()); - $arrayResult = json_decode(json_encode($result), true); + $arrayResult = \G::json_decode(\G::json_encode($result), true); if ($arrayResult["status_code"] == 0) { $applicationUid = $arrayResult["caseId"]; @@ -1327,25 +1397,69 @@ class TimerEvent $common->frontEndShow("TEXT", "> Routing the case #$applicationNumber..."); $this->log("CREATED-NEW-CASE", "Case #$applicationNumber created, APP_UID: $applicationUid, PRO_UID: " . $arrayTimerEventData["PRJ_UID"]); + $this->syslog( + 200 + ,'Case created' + ,'CREATED-NEW-CASE' + ,$datetime + ,''//UsrUid + ,$arrayTimerEventData["PRJ_UID"] + ,$taskUid + ,$applicationUid + ,$applicationNumber + ); //Derivate new case $result = $ws->derivateCase("", $applicationUid, 1); - $arrayResult = json_decode(json_encode($result), true); + $arrayResult = \G::json_decode(\G::json_encode($result), true); if ($arrayResult["status_code"] == 0) { $common->frontEndShow("TEXT", " - OK"); $this->log("ROUTED-NEW-CASE", "Case #$applicationNumber routed, APP_UID: $applicationUid, PRO_UID: " . $arrayTimerEventData["PRJ_UID"]); + $this->syslog( + 200 + ,'Case routed' + ,'ROUTED-NEW-CASE' + ,$datetime + ,''//usrUid + ,$arrayTimerEventData["PRJ_UID"] + ,$taskUid + ,$applicationUid + ,$applicationNumber + ,'1'//Del Index + ); } else { $common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]); $this->log("ROUTED-NEW-CASE", "Failed: " . $arrayResult["message"] . ", Case: #$applicationNumber, APP_UID: $applicationUid, PRO_UID: " . $arrayTimerEventData["PRJ_UID"]); + $this->syslog( + 500 + ,'Failed case routed' + ,'ROUTED-NEW-CASE' + ,$datetime + ,''//usrUid + ,$arrayTimerEventData["PRJ_UID"] + ,$taskUid + ,$applicationUid + ,$applicationNumber + ,'1'//Del Index + ); } } else { $common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]); $this->log("CREATED-NEW-CASE", "Failed: " . $arrayResult["message"] . ", PRO_UID: " . $arrayTimerEventData["PRJ_UID"]); + $this->syslog( + 500 + ,'Failed case created '.$arrayResult["message"] + ,'CREATED-NEW-CASE' + ,$datetime + ,''//usrUid + ,$arrayTimerEventData["PRJ_UID"] + ,$taskUid + ); } $flagRecord = true; @@ -1356,14 +1470,32 @@ class TimerEvent $common->frontEndShow("TEXT", "Not exists any record to start a new case, on date \"$datetime (UTC +00:00)\""); $this->log("NO-RECORDS", "Not exists any record to start a new case"); + $this->syslog( + 200 + ,'Not exists any record to start a new case' + ,'NO-RECORDS' + ,$datetime + ); } $common->frontEndShow("END"); $this->log("END-NEW-CASES", "Date \"$datetime (UTC +00:00)\": End new cases"); + $this->syslog( + 200 + ,'End new cases' + ,'END-NEW-CASES' + ,$datetime + ); //Intermediate Catch Timer-Event (continue the case) /////////////////////////////////////////////////////// $this->log("START-CONTINUE-CASES", "Date \"$datetime (UTC +00:00)\": Start continue the cases"); + $this->syslog( + 200 + ,'Start continue the cases' + ,'START-CONTINUE-CASES' + ,$datetime + ); //Query $criteriaMain = $this->getTimerEventCriteria(); @@ -1533,7 +1665,7 @@ class TimerEvent //Derivate case $result = $ws->derivateCase("", $applicationUid, $delIndex); - $arrayResult = json_decode(json_encode($result), true); + $arrayResult = \G::json_decode(\G::json_encode($result), true); if ($arrayResult["status_code"] == 0) { $common->frontEndShow("TEXT", " - OK"); @@ -1543,12 +1675,34 @@ class TimerEvent $common->frontEndShow("TEXT", " - Failed: " . $arrayResult["message"]); $this->log("CONTINUED-CASE", "Failed: " . $arrayResult["message"] . ", Case: #$applicationNumber, APP_UID: $applicationUid, PRO_UID: " . $arrayTimerEventData["PRJ_UID"]); + $this->syslog( + 500 + ,'Failed '.$arrayResult["message"] + ,'CONTINUED-CASE' + ,$datetime + ,''//usrUid + ,$arrayTimerEventData["PRJ_UID"] + ,$tasUid + ,$applicationUid + ,$applicationNumber + ); } $flagRecord = true; } } else { $this->log("INVALID-CONTINUE-DATE", "Continue date: $continueCaseDate, Case: #$applicationNumber, APP_UID: $applicationUid, PRO_UID: " . $arrayTimerEventData["PRJ_UID"]); + $this->syslog( + 200 + ,'Continue date '. $continueCaseDate + ,'INVALID-CONTINUE-DATE' + ,$datetime + ,''//usrUid + ,$arrayTimerEventData["PRJ_UID"] + ,$tasUid + ,$applicationUid + ,$applicationNumber + ); } $counter++; @@ -1563,6 +1717,12 @@ class TimerEvent $common->frontEndShow("TEXT", "Not exists any record to continue a case, on date \"$datetime (UTC +00:00)\""); $this->log("NO-RECORDS", "Not exists any record to continue a case"); + $this->syslog( + 200 + ,'Not exists any record to continue a case' + ,'NO-RECORDS' + ,$datetime + ); } $common->frontEndShow("END"); diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index 087e0461d..85c6200c2 100755 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -889,6 +889,9 @@ Bootstrap::LoadSystem( 'rbac' ); $RBAC = &RBAC::getSingleton( PATH_DATA, session_id() ); $RBAC->sSystem = 'PROCESSMAKER'; +//Enable Monolog +Bootstrap::initVendors(); +Bootstrap::LoadSystem( 'monologProvider' ); // define and send Headers for all pages if (! defined( 'EXECUTE_BY_CRON' )) { header( "Expires: " . gmdate( "D, d M Y H:i:s", mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'Y' ) ) ) . " GMT" );