PMCORE-1335 ProcessMaker core should be use the native Laravel log mechanism.
This commit is contained in:
14
app/Foundation/Application.php
Normal file
14
app/Foundation/Application.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Foundation;
|
||||
|
||||
use Illuminate\Foundation\Application as BaseApplication;
|
||||
|
||||
class Application extends BaseApplication
|
||||
{
|
||||
|
||||
protected function registerBaseServiceProviders(): void
|
||||
{
|
||||
parent::registerBaseServiceProviders();
|
||||
}
|
||||
}
|
||||
68
app/Log/LogManager.php
Normal file
68
app/Log/LogManager.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Log;
|
||||
|
||||
use Illuminate\Log\LogManager as BaseLogManager;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
class LogManager extends BaseLogManager
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the log connection configuration.
|
||||
*
|
||||
* @param string $name
|
||||
* @return array
|
||||
*/
|
||||
protected function configurationFor($name)
|
||||
{
|
||||
//default
|
||||
if (!Str::contains($name, ':')) {
|
||||
return parent::configurationFor($name);
|
||||
}
|
||||
|
||||
//extend channel
|
||||
$parse = explode(':', $name, 2);
|
||||
if (empty($parse[0])) {
|
||||
$parse[0] = config('logging.default');
|
||||
}
|
||||
$config = parent::configurationFor($parse[0]);
|
||||
if (!empty($parse[1])) {
|
||||
$config['name'] = $parse[1];
|
||||
}
|
||||
|
||||
//extends
|
||||
if (!defined('PATH_DATA') || !defined('PATH_SEP')) {
|
||||
return $config;
|
||||
}
|
||||
$sys = System::getSystemConfiguration();
|
||||
|
||||
//level
|
||||
if (!empty($sys['logging_level'])) {
|
||||
$levels = ['emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug'];
|
||||
$level = strtolower($sys['logging_level']);
|
||||
if (in_array($level, $levels)) {
|
||||
$config['level'] = $level;
|
||||
}
|
||||
}
|
||||
|
||||
//path
|
||||
$basePath = PATH_DATA . 'sites' . PATH_SEP . config('system.workspace') . PATH_SEP . 'log' . PATH_SEP;
|
||||
$config['path'] = $basePath . File::basename($config['path']);
|
||||
if (!empty($sys['logs_location'])) {
|
||||
$config['path'] = $sys['logs_location'];
|
||||
}
|
||||
|
||||
//days
|
||||
if (!empty($sys['logs_max_files'])) {
|
||||
$value = intval($sys['logs_max_files']);
|
||||
if ($value >= 0) {
|
||||
$config['days'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ use Monolog\Formatter\LineFormatter;
|
||||
|
||||
class CustomizeFormatter
|
||||
{
|
||||
private $format = "<%level%> %datetime% %channel% %level_name%: %message% %context%\n";
|
||||
private $dateFormat = "M d H:i:s";
|
||||
|
||||
/**
|
||||
* Customize the given logger instance.
|
||||
@@ -16,7 +18,7 @@ class CustomizeFormatter
|
||||
public function __invoke($logger)
|
||||
{
|
||||
foreach ($logger->getHandlers() as $handler) {
|
||||
$handler->setFormatter(new LineFormatter(null, null, true, true));
|
||||
$handler->setFormatter(new LineFormatter($this->format, $this->dateFormat, true, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,14 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Helpers\Workspace;
|
||||
use App\Log\LogManager;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
@@ -13,7 +17,13 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
App::bind('workspace', function() {
|
||||
return new Workspace();
|
||||
});
|
||||
|
||||
$this->app->singleton('log', function ($app) {
|
||||
return new LogManager($app);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Contracts\Console\Kernel as Kernel2;
|
||||
use Illuminate\Contracts\Debug\ExceptionHandler;
|
||||
use Illuminate\Contracts\Http\Kernel as Kernel4;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Exceptions\Handler;
|
||||
use Illuminate\Foundation\Http\Kernel as Kernel3;
|
||||
use Monolog\Formatter\LineFormatter;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
@@ -21,7 +11,7 @@ use ProcessMaker\Core\System;
|
||||
|
|
||||
*/
|
||||
|
||||
$app = new Application(
|
||||
$app = new App\Foundation\Application(
|
||||
realpath(__DIR__ . '/../')
|
||||
);
|
||||
|
||||
@@ -37,21 +27,21 @@ $app = new Application(
|
||||
*/
|
||||
|
||||
$app->singleton(
|
||||
Kernel4::class,
|
||||
Kernel3::class
|
||||
Illuminate\Contracts\Http\Kernel::class,
|
||||
Illuminate\Foundation\Http\Kernel::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
Kernel2::class,
|
||||
Illuminate\Contracts\Console\Kernel::class,
|
||||
App\Console\Kernel::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
ExceptionHandler::class,
|
||||
Handler::class
|
||||
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||
Illuminate\Foundation\Exceptions\Handler::class
|
||||
);
|
||||
|
||||
$app->useStoragePath(System::getPathsInstalled()->pathData);
|
||||
$app->useStoragePath(ProcessMaker\Core\System::getPathsInstalled()->pathData);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -26,15 +26,9 @@ return [
|
||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||
Illuminate\Bus\BusServiceProvider::class,
|
||||
Illuminate\Redis\RedisServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
App\Providers\AppServiceProvider::class,
|
||||
],
|
||||
|
||||
'aliases' => [
|
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
|
||||
return [
|
||||
|
||||
@@ -35,7 +36,8 @@ return [
|
||||
'channels' => [
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['single'],
|
||||
'channels' => ['daily'],
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
@@ -46,12 +48,18 @@ return [
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'tap' => [
|
||||
App\Logging\CustomizeFormatter::class
|
||||
],
|
||||
'tap' => [App\Logging\CustomizeFormatter::class],
|
||||
'path' => storage_path('logs/processmaker.log'),
|
||||
'level' => env('APP_LOG_LEVEL', 'debug'),
|
||||
'days' => $app->make('config')->get('app.log_max_files', 5),
|
||||
'level' => 'debug',
|
||||
'days' => $app->make('config')->get('app.log_max_files', 60),
|
||||
],
|
||||
|
||||
'audit' => [
|
||||
'driver' => 'daily',
|
||||
'tap' => [App\Logging\CustomizeFormatter::class],
|
||||
'path' => storage_path('logs/audit.log'),
|
||||
'level' => 'debug',
|
||||
'days' => $app->make('config')->get('app.log_max_files', 60),
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
@@ -62,9 +70,20 @@ return [
|
||||
'level' => 'critical',
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => 'debug',
|
||||
'handler' => SyslogUdpHandler::class,
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
@@ -79,7 +98,6 @@ return [
|
||||
'driver' => 'errorlog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
|
||||
@@ -2667,87 +2668,33 @@ class Bootstrap
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores a message in the log file, if the file size exceeds
|
||||
*
|
||||
* @param string $channel The logging channel
|
||||
* @param int $level The logging level
|
||||
* @param string $message The log message
|
||||
* @param array $context The log context
|
||||
* @param string $workspace @todo we need to remove this parameter this is not necessary
|
||||
* @param string $file name file
|
||||
* @param boolean $readLoggingLevel
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function registerMonolog(
|
||||
$channel,
|
||||
$level,
|
||||
$message,
|
||||
$context,
|
||||
$workspace = '',
|
||||
$file = 'processmaker.log',
|
||||
$readLoggingLevel = true
|
||||
)
|
||||
{
|
||||
$registerLogger = MonologProvider::getSingleton($channel, $file, $readLoggingLevel);
|
||||
$registerLogger->addLog($level, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default information from the context
|
||||
* Returns an array containing the values of the current execution context.
|
||||
*
|
||||
* @global object $RBAC
|
||||
* @param array $extraParams
|
||||
* @return array
|
||||
*
|
||||
* @see AdditionalTables->populateReportTable
|
||||
* @see AppAssignSelfServiceValueGroup->createRow
|
||||
* @see Bootstrap->registerMonologPhpUploadExecution()
|
||||
* @see Cases->loadDataSendEmail()
|
||||
* @see Cases->removeCase()
|
||||
* @see Cases->reportTableDeleteRecord()
|
||||
* @see Derivation->derivate
|
||||
* @see G->logTriggerExecution()
|
||||
* @see LdapAdvanced->VerifyLogin
|
||||
* @see ldapadvancedClassCron->executeCron
|
||||
* @see PmDynaform->__construct
|
||||
* @see pmTablesProxy->genDataReport
|
||||
* @see Processes->createFiles
|
||||
* @see ProcessMaker\AuditLog\AuditLog->register
|
||||
* @see ProcessMaker\Util\ParseSoapVariableName->buildVariableName
|
||||
* @see RBAC->checkAutomaticRegister()
|
||||
* @see workflow/engine/classes/class.pmFunctions.php::executeQuery
|
||||
|
||||
* @link https://wiki.processmaker.com/3.3/Actions_by_Email
|
||||
* @link https://wiki.processmaker.com/3.2/ProcessMaker_Functions
|
||||
* @link https://wiki.processmaker.com/3.1/Report_Tables
|
||||
* @link https://wiki.processmaker.com/3.2/Cases/Running_Cases
|
||||
* @link https://wiki.processmaker.com/3.3/login
|
||||
* @link https://wiki.processmaker.com/3.2/Executing_cron.php
|
||||
* @link https://wiki.processmaker.com/3.2/HTML5_Responsive_DynaForm_Designer
|
||||
* @link https://wiki.processmaker.com/3.2/Audit_Log
|
||||
* @link https://wiki.processmaker.com/3.0/ProcessMaker_WSDL_Web_Services
|
||||
*/
|
||||
public static function getDefaultContextLog()
|
||||
public static function context(array $extraParams = []): array
|
||||
{
|
||||
$info = [
|
||||
$context = [
|
||||
'ip' => G::getIpAddress(),
|
||||
'workspace' => !empty(config('system.workspace')) ? config('system.workspace') : 'Undefined Workspace',
|
||||
'workspace' => config('system.workspace', 'Undefined Workspace'),
|
||||
'timeZone' => DateTime::convertUtcToTimeZone(date('Y-m-d H:m:s')),
|
||||
'usrUid' => G::LoadTranslation('UID_UNDEFINED_USER')
|
||||
];
|
||||
$context = array_merge($context, $extraParams);
|
||||
|
||||
//get session user
|
||||
global $RBAC;
|
||||
if (!empty($RBAC) && !empty($RBAC->aUserInfo['USER_INFO']) && !empty($RBAC->aUserInfo['USER_INFO']['USR_UID'])) {
|
||||
$info['usrUid'] = $RBAC->aUserInfo['USER_INFO']['USR_UID'];
|
||||
return $info;
|
||||
$context['usrUid'] = $RBAC->aUserInfo['USER_INFO']['USR_UID'];
|
||||
return $context;
|
||||
}
|
||||
|
||||
//if default session exists
|
||||
if (!empty($_SESSION['USER_LOGGED'])) {
|
||||
$info['usrUid'] = $_SESSION['USER_LOGGED'];
|
||||
return $info;
|
||||
$context['usrUid'] = $_SESSION['USER_LOGGED'];
|
||||
return $context;
|
||||
}
|
||||
|
||||
return $info;
|
||||
return $context;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2764,27 +2711,6 @@ class Bootstrap
|
||||
}
|
||||
|
||||
/**
|
||||
* Record the action of executing a php file or attempting to upload a php
|
||||
* file in server.
|
||||
* @param type $channel
|
||||
* @param type $level
|
||||
* @param type $message
|
||||
* @param type $fileName
|
||||
*/
|
||||
public static function registerMonologPhpUploadExecution($channel, $level, $message, $fileName)
|
||||
{
|
||||
$context = \Bootstrap::getDefaultContextLog();
|
||||
$context['action'] = $channel;
|
||||
$context['filename'] = $fileName;
|
||||
if (defined("SYS_CURRENT_URI") && defined("SYS_CURRENT_PARMS")) {
|
||||
$context['url'] = SYS_CURRENT_URI . '?' . SYS_CURRENT_PARMS;
|
||||
}
|
||||
$context['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '';
|
||||
$sysSys = !empty(config("system.workspace")) ? config("system.workspace") : "Undefined";
|
||||
\Bootstrap::registerMonolog($channel, $level, $message, $context, $sysSys, 'processmaker.log');
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the constant to related the Workspaces
|
||||
*
|
||||
* @param string $workspace
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -234,6 +235,7 @@ class DataBaseMaintenance
|
||||
*/
|
||||
public function dumpData($table)
|
||||
{
|
||||
$sql = "";
|
||||
try {
|
||||
$this->outfile = $this->tmpDir . $table . '.dump';
|
||||
|
||||
@@ -248,10 +250,12 @@ class DataBaseMaintenance
|
||||
|
||||
return true;
|
||||
} catch (QueryException $exception) {
|
||||
$ws = (!empty(config('system.workspace'))) ? config('system.workspace') : 'Undefined Workspace';
|
||||
Bootstrap::registerMonolog('MysqlCron', 400, $exception->getMessage(), ['sql' => $sql], $ws, 'processmaker.log');
|
||||
$varRes = $exception->getMessage() . "\n";
|
||||
G::outRes($varRes);
|
||||
$message = $exception->getMessage();
|
||||
$context = [
|
||||
'sql' => $sql
|
||||
];
|
||||
Log::channel(':MysqlCron')->error($message, Bootstrap::context($context));
|
||||
G::outRes($message . "\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -265,18 +269,19 @@ class DataBaseMaintenance
|
||||
*/
|
||||
public function restoreData($backupFile)
|
||||
{
|
||||
$sql = "";
|
||||
try {
|
||||
$tableName = str_replace('.dump', '', basename($backupFile));
|
||||
$sql = "LOAD DATA INFILE '$backupFile' INTO TABLE $tableName FIELDS TERMINATED BY '\t|\t' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\t\t\r\r\n'";
|
||||
|
||||
DB::connection($this->getConnect())->raw($sql);
|
||||
|
||||
return true;
|
||||
} catch (QueryException $exception) {
|
||||
$ws = (!empty(config("system.workspace"))) ? config("system.workspace") : "Wokspace Undefined";
|
||||
Bootstrap::registerMonolog('MysqlCron', 400, $exception->getMessage(), ['sql' => $sql], $ws, 'processmaker.log');
|
||||
$varRes = $exception->getMessage() . "\n";
|
||||
G::outRes($varRes);
|
||||
$message = $exception->getMessage();
|
||||
$context = [
|
||||
'sql' => $sql
|
||||
];
|
||||
Log::channel(':MysqlCron')->error($message, Bootstrap::context($context));
|
||||
G::outRes($message . "\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\AuditLog\AuditLog;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
@@ -1180,12 +1181,21 @@ class G
|
||||
if ($download) {
|
||||
G::sendHeaders($filename, 'text/plain', $download, $downloadFileName);
|
||||
} else {
|
||||
if (\Bootstrap::getDisablePhpUploadExecution() === 0) {
|
||||
\Bootstrap::registerMonologPhpUploadExecution('phpExecution', 200, 'Php Execution', $filename);
|
||||
if (Bootstrap::getDisablePhpUploadExecution() === 0) {
|
||||
$message = 'Php Execution';
|
||||
$context = [
|
||||
'filename' => $filename,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpExecution')->info($message, Bootstrap::context($context));
|
||||
require_once($filename);
|
||||
} else {
|
||||
$message = G::LoadTranslation('ID_THE_PHP_FILES_EXECUTION_WAS_DISABLED');
|
||||
\Bootstrap::registerMonologPhpUploadExecution('phpExecution', 550, $message, $filename);
|
||||
$context = [
|
||||
'filename' => $filename,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpExecution')->alert($message, Bootstrap::context($context));
|
||||
echo $message;
|
||||
}
|
||||
return;
|
||||
@@ -5699,10 +5709,14 @@ class G
|
||||
}
|
||||
$fullName = empty($_SESSION['USR_FULLNAME']) ? $fullName : $_SESSION['USR_FULLNAME'];
|
||||
|
||||
$auditLog = new AuditLog();
|
||||
$auditLog->setUserLogged($userUid);
|
||||
$auditLog->setUserFullname($fullName);
|
||||
$auditLog->register($actionToLog, $valueToLog);
|
||||
$message = $actionToLog;
|
||||
$context = [
|
||||
'usrUid' => $userUid,
|
||||
'usrName' => $fullName,
|
||||
'action' => $actionToLog,
|
||||
'description' => $valueToLog
|
||||
];
|
||||
Log::channel('audit:' . $actionToLog)->info($message, Bootstrap::context($context));
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
@@ -6079,26 +6093,24 @@ class G
|
||||
public static function logTriggerExecution($data, $error = 'NO-ERROR', $typeError = '', $executionTime = 0)
|
||||
{
|
||||
if ((!empty($data['_CODE_']) || $typeError == 'FATAL_ERROR') && empty($data['_DATA_TRIGGER_']['_TRI_LOG_'])) {
|
||||
$lg = Bootstrap::getDefaultContextLog();
|
||||
$lg['triTitle'] = isset($data['_DATA_TRIGGER_']['TRI_TITLE']) ? $data['_DATA_TRIGGER_']['TRI_TITLE'] : '';
|
||||
$lg['triUid'] = isset($data['_DATA_TRIGGER_']['TRI_UID']) ? $data['_DATA_TRIGGER_']['TRI_UID'] : '';
|
||||
$lg['triCode'] = isset($data['_DATA_TRIGGER_']['TRI_WEBBOT']) ? $data['_DATA_TRIGGER_']['TRI_WEBBOT'] : '';
|
||||
$lg['triExecutionTime'] = $executionTime;
|
||||
$lg['triMessageError'] = $error;
|
||||
$lg['appUid'] = isset($data['APPLICATION']) ? $data['APPLICATION'] : '';
|
||||
$lg['proUid'] = isset($data['PROCESS']) ? $data['PROCESS'] : '';
|
||||
$lg['tasUid'] = isset($data['TASK']) ? $data['TASK'] : '';
|
||||
$lg['usrUid'] = isset($data['USER_LOGGED']) ? $data['USER_LOGGED'] : '';
|
||||
|
||||
Bootstrap::registerMonolog(
|
||||
(empty($error)) ? 'TriggerExecution' : 'TriggerExecutionError',
|
||||
(empty($error)) ? 200 : 400,
|
||||
(empty($error)) ? 'Trigger Execution' : 'Trigger Execution Error',
|
||||
$lg,
|
||||
$lg['workspace'],
|
||||
'processmaker.log'
|
||||
);
|
||||
|
||||
$context = [
|
||||
'triTitle' => isset($data['_DATA_TRIGGER_']['TRI_TITLE']) ? $data['_DATA_TRIGGER_']['TRI_TITLE'] : '',
|
||||
'triUid' => isset($data['_DATA_TRIGGER_']['TRI_UID']) ? $data['_DATA_TRIGGER_']['TRI_UID'] : '',
|
||||
'triCode' => isset($data['_DATA_TRIGGER_']['TRI_WEBBOT']) ? $data['_DATA_TRIGGER_']['TRI_WEBBOT'] : '',
|
||||
'triExecutionTime' => $executionTime,
|
||||
'triMessageError' => $error,
|
||||
'appUid' => isset($data['APPLICATION']) ? $data['APPLICATION'] : '',
|
||||
'proUid' => isset($data['PROCESS']) ? $data['PROCESS'] : '',
|
||||
'tasUid' => isset($data['TASK']) ? $data['TASK'] : '',
|
||||
'usrUid' => isset($data['USER_LOGGED']) ? $data['USER_LOGGED'] : '',
|
||||
];
|
||||
if (empty($error)) {
|
||||
$message = 'Trigger Execution';
|
||||
Log::channel(':TriggerExecution')->info($message, Bootstrap::context($context));
|
||||
} else {
|
||||
$message = 'Trigger Execution Error';
|
||||
Log::channel(':TriggerExecutionError')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
$_SESSION['_DATA_TRIGGER_']['_TRI_LOG_'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,500 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Formatter\LineFormatter;
|
||||
use Monolog\Handler\RotatingFileHandler;
|
||||
use Monolog\Logger;
|
||||
use Monolog\Processor\IntrospectionProcessor;
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
class MonologProvider
|
||||
{
|
||||
/**
|
||||
* @var MonologProvider
|
||||
*/
|
||||
private static $instance = null;
|
||||
/**
|
||||
* @var LineFormatter
|
||||
*/
|
||||
private $formatter;
|
||||
/**
|
||||
* @var RotatingFileHandler
|
||||
*/
|
||||
private $streamRoutating;
|
||||
/**
|
||||
* @var Logger
|
||||
*/
|
||||
private $registerLogger;
|
||||
|
||||
//the default format "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
|
||||
private $output = "<%level%> %datetime% %channel% %level_name%: %message% %context%\n";
|
||||
private $dateFormat = 'M d H:i:s';
|
||||
/**
|
||||
* The maximal amount of files to keep (0 means unlimited)
|
||||
* @var int
|
||||
*/
|
||||
private $maxFilesToKeep;
|
||||
/**
|
||||
* @var int level debug
|
||||
*/
|
||||
private $levelDebug;
|
||||
/**
|
||||
* Whether the messages that are handled can bubble up the stack or not
|
||||
* @var boolean
|
||||
*/
|
||||
private $bubble = true;
|
||||
/**
|
||||
* @var int file permissions
|
||||
*/
|
||||
private $filePermission;
|
||||
/**
|
||||
* @var string path file
|
||||
*/
|
||||
private $pathFile;
|
||||
|
||||
/**
|
||||
* Logging levels from loo protocol defined in RFC 5424
|
||||
*
|
||||
* @var array $levels Logging levels
|
||||
*/
|
||||
protected static $levels = [
|
||||
'DEBUG' => 100,
|
||||
'INFO' => 200,
|
||||
'NOTICE' => 250,
|
||||
'WARNING' => 300,
|
||||
'ERROR' => 400,
|
||||
'CRITICAL' => 500,
|
||||
'ALERT' => 550,
|
||||
'EMERGENCY' => 600
|
||||
];
|
||||
|
||||
/**
|
||||
* Construct of the class
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $fileLog
|
||||
* @param boolean $readLoggingLevel
|
||||
*
|
||||
*/
|
||||
public function __construct($channel, $fileLog, $readLoggingLevel = true)
|
||||
{
|
||||
//Set path where the file will be saved
|
||||
$pathFile = $this->definePathFile();
|
||||
$this->setPathFile($pathFile);
|
||||
|
||||
//Set maximal amount of files to keep (0 means unlimited)
|
||||
$maxFilesToRotation = $this->defineMaxFiles();
|
||||
$this->setMaxFiles($maxFilesToRotation);
|
||||
|
||||
/**
|
||||
* The permissions are normally set at the operating system level, and it's the IT administrator responsibility to set the correct file permissions
|
||||
* It's not recommendable define in the env.ini configuration
|
||||
*/
|
||||
$permissionFile = 0666;
|
||||
$permissionFile = is_int($permissionFile) ? decoct($permissionFile) : $permissionFile;
|
||||
$this->setFilePermission($permissionFile);
|
||||
|
||||
$this->setFormatter();
|
||||
//Set the config: channel, fileLog and levelDebug that will be saved
|
||||
$this->setConfig($channel, $fileLog, $readLoggingLevel);
|
||||
|
||||
$this->testWriteLog($channel, $fileLog, [
|
||||
$pathFile
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function defines the debug level
|
||||
* We will to check if the logging_level exist in the env.ini
|
||||
*
|
||||
* @param boolean $readLoggingLevel
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function defineLevelDebug($readLoggingLevel = true)
|
||||
{
|
||||
$levelDebug = 'INFO';
|
||||
|
||||
if ($readLoggingLevel) {
|
||||
//In the parse_ini_file the word NONE are considered FALSE
|
||||
if (defined('LOGGING_LEVEL')) {
|
||||
$levelDebug = !empty(LOGGING_LEVEL) ? LOGGING_LEVEL : 'NONE';
|
||||
} else {
|
||||
//Getting configuration from env.ini
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
$levelDebug = !empty($sysConf['logging_level']) ? $sysConf['logging_level'] : 'NONE';
|
||||
}
|
||||
}
|
||||
|
||||
return $levelDebug;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function defines the path file
|
||||
* We will to check if the logs_location exist in the env.ini
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function definePathFile()
|
||||
{
|
||||
$path = PATH_DATA . 'sites' . PATH_SEP . config('system.workspace') . PATH_SEP . 'log' . PATH_SEP;
|
||||
|
||||
if (defined('LOGS_LOCATION')) {
|
||||
$path = !empty(LOGS_LOCATION) ? LOGS_LOCATION : $path;
|
||||
} else {
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
$path = !empty($sysConf['logs_location']) ? $sysConf['logs_location'] : $path;
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function defines the max number of files
|
||||
* We will to check if the logs_max_files exist in the env.ini
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
private function defineMaxFiles()
|
||||
{
|
||||
$maxFilesToRotation = 60;
|
||||
|
||||
if (defined('LOGS_MAX_FILES')) {
|
||||
$maxFilesToRotation = !empty(LOGS_MAX_FILES) ? LOGS_MAX_FILES : $maxFilesToRotation;
|
||||
} else {
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
$maxFilesToRotation = !empty($sysConf['logs_max_files']) ? $sysConf['logs_max_files'] : $maxFilesToRotation;
|
||||
}
|
||||
|
||||
return $maxFilesToRotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test write log
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $fileLog
|
||||
* @param array $paths
|
||||
*/
|
||||
private function testWriteLog($channel, $fileLog, $paths)
|
||||
{
|
||||
$fileInfo = pathinfo($fileLog);
|
||||
$timedFilename = str_replace(
|
||||
['{filename}', '{date}'],
|
||||
[$fileInfo['filename'], date('Y-m-d')],
|
||||
'{filename}-{date}'
|
||||
);
|
||||
|
||||
if (!empty($fileInfo['extension'])) {
|
||||
$timedFilename .= '.' . $fileInfo['extension'];
|
||||
}
|
||||
|
||||
if (!file_exists($this->getPathFile() . $timedFilename)) {
|
||||
try {
|
||||
$level = $this->getLevelDebug();
|
||||
if (!empty($level)) {
|
||||
$this->getLogger()->addRecord($level, 'Start writing the log file');
|
||||
}
|
||||
} catch (UnexpectedValueException $exception) {
|
||||
//In case that the file can not be written, it will be written to the standard log file.
|
||||
error_log($exception->getMessage());
|
||||
if ($paths) {
|
||||
$path = array_shift($paths);
|
||||
$this->setPathFile($path);
|
||||
$this->setConfig($channel, $fileLog);
|
||||
$this->testWriteLog($channel, $fileLog, $paths);
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
//In case of an exception, it will be written to the standard log file.
|
||||
error_log($exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Formatter
|
||||
*
|
||||
* @return LineFormatter
|
||||
*/
|
||||
public function getFormatter()
|
||||
{
|
||||
return $this->formatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set LineFormatter $formatter
|
||||
*/
|
||||
public function setFormatter()
|
||||
{
|
||||
$this->formatter = new LineFormatter($this->getOutput(), $this->getDateFormat());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RotatingFileHandler
|
||||
*/
|
||||
public function getStream()
|
||||
{
|
||||
return $this->streamRoutating;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string File name
|
||||
*/
|
||||
public function setStream($fileLog)
|
||||
{
|
||||
// ONLY initialize a new RotatingFileHandler if the fileLog is DIFFERENT.
|
||||
//Set Routating Handler
|
||||
$this->streamRoutating = new RotatingFileHandler($this->getPathFile() . $fileLog,
|
||||
$this->getMaxFiles(),
|
||||
$this->getLevelDebug(),
|
||||
$this->isBubble(),
|
||||
$this->getFilePermissionOctDec());
|
||||
|
||||
$this->streamRoutating->setFormatter($this->getFormatter());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Logger
|
||||
*/
|
||||
public function getLogger()
|
||||
{
|
||||
return $this->registerLogger;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $channel The logging channel
|
||||
*/
|
||||
public function setLogger($channel)
|
||||
{
|
||||
//Create the channel and register the Logger with StreamRoutating
|
||||
$this->registerLogger = new Logger($channel);
|
||||
$this->registerLogger->pushProcessor(new IntrospectionProcessor());
|
||||
$this->registerLogger->pushHandler($this->getStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return format output
|
||||
* @return string
|
||||
*/
|
||||
public function getOutput()
|
||||
{
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set format output
|
||||
*
|
||||
* @param string $output
|
||||
*/
|
||||
public function setOutput($output)
|
||||
{
|
||||
$this->output = $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return date format
|
||||
* @return string
|
||||
*/
|
||||
public function getDateFormat()
|
||||
{
|
||||
return $this->dateFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set date format
|
||||
* @param string $dateFormat
|
||||
*/
|
||||
public function setDateFormat($dateFormat)
|
||||
{
|
||||
$this->dateFormat = $dateFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return is can bubble up the stack or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBubble()
|
||||
{
|
||||
return $this->bubble;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set bubble
|
||||
*
|
||||
* @param boolean $bubble
|
||||
*/
|
||||
public function setBubble($bubble)
|
||||
{
|
||||
$this->bubble = $bubble;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return level debug
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLevelDebug()
|
||||
{
|
||||
return $this->levelDebug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return max files
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxFiles()
|
||||
{
|
||||
return $this->maxFilesToKeep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set max files
|
||||
*
|
||||
* @param int $maxFilesToKeep
|
||||
*/
|
||||
public function setMaxFiles($maxFilesToKeep)
|
||||
{
|
||||
$this->maxFilesToKeep = $maxFilesToKeep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return permissions of file
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getFilePermission()
|
||||
{
|
||||
return $this->filePermission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the decimal equivalent of the octal number represented by the octal_string argument.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getFilePermissionOctDec()
|
||||
{
|
||||
return octdec($this->filePermission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set file permissions
|
||||
*
|
||||
* @param int $filePermission
|
||||
*/
|
||||
public function setFilePermission($filePermission)
|
||||
{
|
||||
$this->filePermission = $filePermission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path where the file will be saved
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPathFile()
|
||||
{
|
||||
return $this->pathFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set path
|
||||
*
|
||||
* @param string $pathFile
|
||||
*/
|
||||
public function setPathFile($pathFile)
|
||||
{
|
||||
$pathSep = '/';
|
||||
if (strpos($pathFile, '\\') !== false) {
|
||||
$pathSep = '\\';
|
||||
}
|
||||
if (substr($pathFile, -1, strlen($pathSep)) !== $pathSep) {
|
||||
$pathFile .= $pathSep;
|
||||
}
|
||||
$this->pathFile = $pathFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set level debug by string
|
||||
*
|
||||
* @param string $levelDebug
|
||||
*/
|
||||
public function setLevelDebug($levelDebug)
|
||||
{
|
||||
//If is a valid, we will to define the level
|
||||
if (isset(static::$levels[$levelDebug])) {
|
||||
$level = static::$levels[$levelDebug];
|
||||
$this->levelDebug = $level;
|
||||
} else {
|
||||
//If is other value like NONE will set with empty level
|
||||
$this->levelDebug = '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To get singleton instance
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $channel
|
||||
* @param string $fileLog
|
||||
* @param boolean $readLoggingLevel
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public static function getSingleton($channel, $fileLog, $readLoggingLevel = true)
|
||||
{
|
||||
if (self::$instance === null) {
|
||||
self::$instance = new MonologProvider($channel, $fileLog, $readLoggingLevel);
|
||||
self::$instance->setConfig($channel, $fileLog, $readLoggingLevel);
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set channel and fileLog
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $channel The logging channel
|
||||
* @param string $fileLog name file
|
||||
* @param boolean $readLoggingLevel
|
||||
*/
|
||||
public function setConfig($channel, $fileLog, $readLoggingLevel = true)
|
||||
{
|
||||
$this->setStream($fileLog);
|
||||
$this->setLogger($channel);
|
||||
$levelDebug = $this->defineLevelDebug($readLoggingLevel);
|
||||
$this->setLevelDebug($levelDebug);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register log if the level correspond to the logging_level defined
|
||||
* In other way return false if the log was turn off or the actions does not logged
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param int $level The logging level
|
||||
* @param string $message The log message
|
||||
* @param array $context The log context
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function addLog($level, $message, $context)
|
||||
{
|
||||
if (!empty($this->getLevelDebug()) && $level >= $this->getLevelDebug()) {
|
||||
return $this->getLogger()->addRecord($level, $message, $context);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the instance property
|
||||
*/
|
||||
static function setInstance($instance)
|
||||
{
|
||||
self::$instance = $instance;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* HttpProxyController
|
||||
*
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
|
||||
* @package gulliver.system
|
||||
* @access public
|
||||
*/
|
||||
class PMException extends Exception
|
||||
{
|
||||
|
||||
public function __construct ($message, $code = 0, $previous = null)
|
||||
public function __construct($message, $code = 0, $previous = null)
|
||||
{
|
||||
parent::__construct( $message, 1 );
|
||||
parent::__construct($message, 1);
|
||||
}
|
||||
|
||||
public function __toString ()
|
||||
public function __toString()
|
||||
{
|
||||
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
|
||||
}
|
||||
|
||||
public static function registerErrorLog($error, $token){
|
||||
$ws = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined Workspace";
|
||||
Bootstrap::registerMonolog('ExceptionCron', 400, $error->getMessage(), array('token'=>$token), $ws, 'processmaker.log');
|
||||
public static function registerErrorLog($error, $token)
|
||||
{
|
||||
$message = $error->getMessage();
|
||||
$context = [
|
||||
'token' => $token
|
||||
];
|
||||
Log::channel(':ExceptionCron')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Exception\RBACException;
|
||||
|
||||
class RBAC
|
||||
@@ -917,10 +918,12 @@ class RBAC
|
||||
return $res;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context["action"] = "ldapSynchronize";
|
||||
$context["authSource"] = $row;
|
||||
Bootstrap::registerMonolog("ldapSynchronize", 400, $e->getMessage(), $context, $context["workspace"], "processmaker.log");
|
||||
$message = $e->getMessage();
|
||||
$context = [
|
||||
'action' => 'ldapSynchronize',
|
||||
'authSource' => $row
|
||||
];
|
||||
Log::channel(':ldapSynchronize')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,14 +45,14 @@ class CustomizeFormatterTest extends TestCase
|
||||
public function levelProviders()
|
||||
{
|
||||
return [
|
||||
['emergency', 'production.EMERGENCY'],
|
||||
['alert', 'production.ALERT'],
|
||||
['critical', 'production.CRITICAL'],
|
||||
['error', 'production.ERROR'],
|
||||
['warning', 'production.WARNING'],
|
||||
['notice', 'production.NOTICE'],
|
||||
['info', 'production.INFO'],
|
||||
['debug', 'production.DEBUG'],
|
||||
['emergency', 'EMERGENCY'],
|
||||
['alert', 'ALERT'],
|
||||
['critical', 'CRITICAL'],
|
||||
['error', 'ERROR'],
|
||||
['warning', 'WARNING'],
|
||||
['notice', 'NOTICE'],
|
||||
['info', 'INFO'],
|
||||
['debug', 'DEBUG'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,247 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\gulliver\system;
|
||||
|
||||
use MonologProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \MonologProvider
|
||||
*/
|
||||
class MonologProviderTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* It tests an undefined level
|
||||
*
|
||||
* @covers ::setLevelDebug
|
||||
* @test
|
||||
*/
|
||||
public function it_check_log_when_logging_level_is_undefined()
|
||||
{
|
||||
$log = MonologProvider::getSingleton('Channel Test', 'processmaker.log', true);
|
||||
// Define the logging_level = UNDEFINED value
|
||||
$log->setLevelDebug('UNDEFINED');
|
||||
$this->assertEmpty($log->getLevelDebug());
|
||||
// Register a log debug
|
||||
$res = $log->addLog(100, 'This test can not be registered', []);
|
||||
// Check that the DEBUG was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log info
|
||||
$res = $log->addLog(200, 'This test can not be registered', []);
|
||||
// Check that the INFO was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log warning
|
||||
$res = $log->addLog(300, 'This test can not be registered', []);
|
||||
// Check that the WARNING was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log error
|
||||
$res = $log->addLog(400, 'This test can not be registered', []);
|
||||
// Check that the ERROR was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log critical
|
||||
$res = $log->addLog(500, 'This test can not be registered', []);
|
||||
// Check that the CRITICAL was not registered
|
||||
$this->assertFalse($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests that the log register from NONE, it to turn off the log
|
||||
*
|
||||
* @covers ::addLog
|
||||
* @test
|
||||
*/
|
||||
public function it_check_log_when_logging_level_is_turn_off()
|
||||
{
|
||||
$log = MonologProvider::getSingleton('Channel Test', 'processmaker.log', true);
|
||||
// Define the logging_level = NONE
|
||||
$log->setLevelDebug('NONE');
|
||||
$this->assertEmpty($log->getLevelDebug());
|
||||
// Register a log debug
|
||||
$res = $log->addLog(100, 'This test can not be registered', []);
|
||||
// Check that the DEBUG was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log info
|
||||
$res = $log->addLog(200, 'This test can not be registered', []);
|
||||
// Check that the INFO was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log warning
|
||||
$res = $log->addLog(300, 'This test can not be registered', []);
|
||||
// Check that the WARNING was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log error
|
||||
$res = $log->addLog(400, 'This test can not be registered', []);
|
||||
// Check that the ERROR was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log critical
|
||||
$res = $log->addLog(500, 'This test can not be registered', []);
|
||||
// Check that the CRITICAL was not registered
|
||||
$this->assertFalse($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests that the log register from INFO
|
||||
*
|
||||
* @covers ::addLog
|
||||
* @test
|
||||
*/
|
||||
public function it_check_log_when_logging_level_is_info()
|
||||
{
|
||||
$log = MonologProvider::getSingleton('Channel Test', 'processmaker.log', true);
|
||||
// Define the logging_level = INFO (200)
|
||||
$log->setLevelDebug('INFO');
|
||||
$this->assertEquals($log->getLevelDebug(), 200);
|
||||
// Register a log debug
|
||||
$res = $log->addLog(100, 'This test can not be registered', []);
|
||||
// Check that the DEBUG was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log info
|
||||
$res = $log->addLog(200, 'Test', []);
|
||||
// Check that the INFO was registered
|
||||
$this->assertTrue($res);
|
||||
// Register a log warning
|
||||
$res = $log->addLog(300, 'Test', []);
|
||||
// Check that the WARNING was registered
|
||||
$this->assertTrue($res);
|
||||
// Register a log error
|
||||
$res = $log->addLog(400, 'Test', []);
|
||||
// Check that the ERROR was registered
|
||||
$this->assertTrue($res);
|
||||
// Register a log critical
|
||||
$res = $log->addLog(500, 'Test', []);
|
||||
// Check that the CRITICAL was registered
|
||||
$this->assertTrue($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests that the log register from WARNING
|
||||
*
|
||||
* @covers ::addLog
|
||||
* @test
|
||||
*/
|
||||
public function it_check_log_when_logging_level_is_warning()
|
||||
{
|
||||
$log = MonologProvider::getSingleton('Channel Test', 'processmaker.log', true);
|
||||
// Define the logging_level WARNING (300)
|
||||
$log->setLevelDebug('WARNING');
|
||||
$this->assertEquals($log->getLevelDebug(), 300);
|
||||
// Register a log debug
|
||||
$res = $log->addLog(100, 'This test can not be registered', []);
|
||||
// Check that the DEBUG was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log info
|
||||
$res = $log->addLog(200, 'This test can not be registered', []);
|
||||
// Check that the INFO was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log warning
|
||||
$res = $log->addLog(300, 'Test', []);
|
||||
// Check that the WARNING was registered
|
||||
$this->assertTrue($res);
|
||||
// Register a log error
|
||||
$res = $log->addLog(400, 'Test', []);
|
||||
// Check that the ERROR was registered
|
||||
$this->assertTrue($res);
|
||||
// Register a log critical
|
||||
$res = $log->addLog(500, 'Test', []);
|
||||
// Check that the CRITICAL was registered
|
||||
$this->assertTrue($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests that the log register from ERROR
|
||||
*
|
||||
* @covers ::addLog
|
||||
* @test
|
||||
*/
|
||||
public function it_check_log_when_logging_level_is_error()
|
||||
{
|
||||
$log = MonologProvider::getSingleton('Channel Test', 'processmaker.log', true);
|
||||
// Define the logging_level ERROR (400)
|
||||
$log->setLevelDebug('ERROR');
|
||||
$this->assertEquals($log->getLevelDebug(), 400);
|
||||
// Register a log debug
|
||||
$res = $log->addLog(100, 'This test can not be registered', []);
|
||||
// Check that the DEBUG was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log info
|
||||
$res = $log->addLog(200, 'This test can not be registered', []);
|
||||
// Check that the INFO was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log warning
|
||||
$res = $log->addLog(300, 'This test can not be registered', []);
|
||||
// Check that the WARNING was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log error
|
||||
$res = $log->addLog(400, 'Test', []);
|
||||
// Check that the ERROR was registered
|
||||
$this->assertTrue($res);
|
||||
// Register a log critical
|
||||
$res = $log->addLog(500, 'Test', []);
|
||||
// Check that the CRITICAL was registered
|
||||
$this->assertTrue($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests that the log register from CRITICAL
|
||||
*
|
||||
* @covers ::addLog
|
||||
* @test
|
||||
*/
|
||||
public function it_check_log_when_logging_level_is_critical()
|
||||
{
|
||||
$log = MonologProvider::getSingleton('Channel Test', 'processmaker.log', true);
|
||||
// Define the logging_level CRITICAL (500)
|
||||
$log->setLevelDebug('CRITICAL');
|
||||
$this->assertEquals($log->getLevelDebug(), 500);
|
||||
// Register a log debug
|
||||
$res = $log->addLog(100, 'This test can not be registered', []);
|
||||
// Check that the DEBUG was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log info
|
||||
$res = $log->addLog(200, 'This test can not be registered', []);
|
||||
// Check that the INFO was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log warning
|
||||
$res = $log->addLog(300, 'This test can not be registered', []);
|
||||
// Check that the WARNING was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log error
|
||||
$res = $log->addLog(400, 'This test can not be registered', []);
|
||||
// Check that the ERROR was not registered
|
||||
$this->assertFalse($res);
|
||||
// Register a log critical
|
||||
$res = $log->addLog(500, 'Test', []);
|
||||
// Check that the CRITICAL was registered
|
||||
$this->assertTrue($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* It tests the getSingleton method
|
||||
*
|
||||
* @covers ::getSingleton
|
||||
* @test
|
||||
*/
|
||||
public function it_test_the_get_singleton_method()
|
||||
{
|
||||
// Call the getSingleton method twice
|
||||
$log = MonologProvider::getSingleton('Channel Test', 'processmaker.log', true);
|
||||
$log = MonologProvider::getSingleton('Channel Test', 'processmaker.log', true);
|
||||
MonologProvider::setInstance("something");
|
||||
// Set level debug to "INFO"
|
||||
$log->setLevelDebug('INFO');
|
||||
// This asserts the lever debug is 200
|
||||
$this->assertEquals($log->getLevelDebug(), 200);
|
||||
// Set level debug to "UNDEFINED"
|
||||
$log->setLevelDebug('UNDEFINED');
|
||||
// This asserts there is no level debug
|
||||
$this->assertEmpty($log->getLevelDebug());
|
||||
}
|
||||
|
||||
/**
|
||||
* It calls the tearDown method
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
MonologProvider::setInstance(null);
|
||||
}
|
||||
}
|
||||
@@ -367,14 +367,10 @@ class gTest extends TestCase
|
||||
$error = 'This is some error';
|
||||
$_SESSION['_DATA_TRIGGER_']['_TRI_LOG_'] = false;
|
||||
G::logTriggerExecution($data, $error, 'FATAL_ERROR', 60);
|
||||
$log = MonologProvider::getSingleton('TriggerExecutionError', 'processmaker.log', true);
|
||||
$this->assertNotEmpty($log->getPathFile());
|
||||
$this->assertTrue($_SESSION['_DATA_TRIGGER_']['_TRI_LOG_']);
|
||||
|
||||
$_SESSION['_DATA_TRIGGER_']['_TRI_LOG_'] = false;
|
||||
G::logTriggerExecution($data, '', '', 100);
|
||||
$log = MonologProvider::getSingleton('TriggerExecution', 'processmaker.log', true);
|
||||
$this->assertNotEmpty($log->getPathFile());
|
||||
$this->assertFalse($_SESSION['_DATA_TRIGGER_']['_TRI_LOG_']);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\BusinessModel\EmailServer;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Services\Api\Project\Variable;
|
||||
@@ -565,11 +566,11 @@ class ActionsByEmailCoreClass extends PMPlugin
|
||||
if (empty($data->DEL_INDEX)) {
|
||||
throw new Exception('The parameter $data->DEL_INDEX is null or empty.');
|
||||
} elseif ($data->DEL_INDEX === 1) {
|
||||
// Processmaker log
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context['delIndex'] = $data->DEL_INDEX;
|
||||
Bootstrap::registerMonolog('ActionByEmail', 250, 'Actions by email does not work in the initial task', $context);
|
||||
|
||||
$message = 'Actions by email does not work in the initial task';
|
||||
$context = [
|
||||
'delIndex' => $data->DEL_INDEX
|
||||
];
|
||||
Log::channel(':ActionByEmail')->notice($message, Bootstrap::context($context));
|
||||
return;
|
||||
} else {
|
||||
$this->setIndex($data->DEL_INDEX);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\BusinessModel\User as BusinessModelUser;
|
||||
use ProcessMaker\BusinessModel\WebEntryEvent;
|
||||
use ProcessMaker\Cases\CasesTrait;
|
||||
@@ -1099,7 +1100,12 @@ class Cases
|
||||
$oDerivation->verifyIsCaseChild($sAppUid);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog('DeleteCases', 200, 'Error in sub-process when trying to route a child case related to the case', ['application_uid' => $sAppUid, 'error' => $e->getMessage()], config("system.workspace"), 'processmaker.log');
|
||||
$message = 'Error in sub-process when trying to route a child case related to the case';
|
||||
$context = [
|
||||
'application_uid' => $sAppUid,
|
||||
'error' => $e->getMessage()
|
||||
];
|
||||
Log::channel(':DeleteCases')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
//Delete the registries in the table SUB_APPLICATION
|
||||
@@ -1153,12 +1159,13 @@ class Cases
|
||||
}
|
||||
}
|
||||
|
||||
/** ProcessMaker log*/
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context['appUid'] = $appUidCopy;
|
||||
$context['request'] = $nameFiles;
|
||||
Bootstrap::registerMonolog('DeleteCases', 200, 'Delete Case', $context);
|
||||
|
||||
/** ProcessMaker log */
|
||||
$message = 'Delete Case';
|
||||
$context = [
|
||||
'appUid' => $appUidCopy,
|
||||
'request' => $nameFiles
|
||||
];
|
||||
Log::channel(':DeleteCases')->info($message, Bootstrap::context($context));
|
||||
return $result;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
@@ -2259,7 +2266,8 @@ class Cases
|
||||
}
|
||||
|
||||
//Log
|
||||
$data = [
|
||||
$message = 'Create case';
|
||||
$context = $data = [
|
||||
"appUid" => $sAppUid,
|
||||
"usrUid" => $sUsrUid,
|
||||
"tasUid" => $sTasUid,
|
||||
@@ -2268,8 +2276,7 @@ class Cases
|
||||
"delIndex" => $iDelIndex,
|
||||
"appInitDate" => $Fields['APP_INIT_DATE']
|
||||
];
|
||||
Bootstrap::registerMonolog('CreateCase', 200, "Create case", $data, config("system.workspace"), 'processmaker.log');
|
||||
|
||||
Log::channel(':CreateCase')->info($message, Bootstrap::context($context));
|
||||
//call plugin
|
||||
if (class_exists('folderData')) {
|
||||
$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $newValues['APP_TITLE'], $sUsrUid);
|
||||
@@ -5517,17 +5524,19 @@ class Cases
|
||||
$from = $fromName . (($fromMail != '') ? ' <' . $fromMail . '>' : '');
|
||||
//If the configuration was not configured correctly
|
||||
if (empty($fromMail)) {
|
||||
$dataLog = \Bootstrap::getDefaultContextLog();
|
||||
$dataLog['appUid'] = $arrayData['APPLICATION'];
|
||||
$dataLog['usrUid'] = $arrayData['USER_LOGGED'];
|
||||
$dataLog['appNumber'] = $arrayData['APP_NUMBER'];
|
||||
$dataLog['tasUid'] = $arrayData['TASK'];
|
||||
$dataLog['proUid'] = $aTaskInfo['PRO_UID'];
|
||||
$dataLog['appMessageStatus'] = 'pending';
|
||||
$dataLog['subject'] = $sSubject;
|
||||
$dataLog['from'] = $from;
|
||||
$dataLog['action'] = G::LoadTranslation('ID_EMAIL_SERVER_FROM_MAIL_EMPTY');
|
||||
Bootstrap::registerMonolog('EmailServer', 300, 'Email server', $dataLog, $dataLog['workspace'], 'processmaker.log');
|
||||
$message = 'Email server';
|
||||
$context = [
|
||||
'appUid' => $arrayData['APPLICATION'],
|
||||
'usrUid' => $arrayData['USER_LOGGED'],
|
||||
'appNumber' => $arrayData['APP_NUMBER'],
|
||||
'tasUid' => $arrayData['TASK'],
|
||||
'proUid' => $aTaskInfo['PRO_UID'],
|
||||
'appMessageStatus' => 'pending',
|
||||
'subject' => $sSubject,
|
||||
'from' => $from,
|
||||
'action' => G::LoadTranslation('ID_EMAIL_SERVER_FROM_MAIL_EMPTY')
|
||||
];
|
||||
Log::channel(':EmailServer')->warning($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
$dataLastEmail['msgError'] = $msgError;
|
||||
@@ -5598,17 +5607,19 @@ class Cases
|
||||
$from = $fromName . (($fromMail != '') ? ' <' . $fromMail . '>' : '');
|
||||
//If the configuration was not configured correctly
|
||||
if (empty($fromMail)) {
|
||||
$dataLog = \Bootstrap::getDefaultContextLog();
|
||||
$dataLog['appUid'] = $arrayData['APPLICATION'];
|
||||
$dataLog['usrUid'] = $arrayData['USER_LOGGED'];
|
||||
$dataLog['appNumber'] = $arrayData['APP_NUMBER'];
|
||||
$dataLog['tasUid'] = $arrayData['TASK'];
|
||||
$dataLog['proUid'] = $aTaskInfo['PRO_UID'];
|
||||
$dataLog['appMessageStatus'] = 'pending';
|
||||
$dataLog['subject'] = $sSubject;
|
||||
$dataLog['from'] = $from;
|
||||
$dataLog['action'] = G::LoadTranslation('ID_EMAIL_SERVER_FROM_MAIL_EMPTY');
|
||||
Bootstrap::registerMonolog('EmailServer', 300, 'Email server', $dataLog, $dataLog['workspace'], 'processmaker.log');
|
||||
$message = 'Email server';
|
||||
$context = [
|
||||
'appUid' => $arrayData['APPLICATION'],
|
||||
'usrUid' => $arrayData['USER_LOGGED'],
|
||||
'appNumber' => $arrayData['APP_NUMBER'],
|
||||
'tasUid' => $arrayData['TASK'],
|
||||
'proUid' => $aTaskInfo['PRO_UID'],
|
||||
'appMessageStatus' => 'pending',
|
||||
'subject' => $sSubject,
|
||||
'from' => $from,
|
||||
'action' => G::LoadTranslation('ID_EMAIL_SERVER_FROM_MAIL_EMPTY')
|
||||
];
|
||||
Log::channel(':EmailServer')->warning($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
$dataLastEmail['msgError'] = $msgError;
|
||||
@@ -7357,6 +7368,7 @@ class Cases
|
||||
$additionalTables = new AdditionalTables();
|
||||
$listTables = $additionalTables->getReportTables($applicationFields["PRO_UID"]);
|
||||
$pmTable = new PmTable();
|
||||
$tableName = '';
|
||||
foreach ($listTables as $row) {
|
||||
try {
|
||||
$tableName = $row["ADD_TAB_NAME"];
|
||||
@@ -7367,11 +7379,13 @@ class Cases
|
||||
$criteria->add($pmTablePeer::APP_UID, $applicationUid);
|
||||
$pmTablePeer::doDelete($criteria);
|
||||
} catch (Exception $e) {
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context['appUid'] = $applicationUid;
|
||||
$context['proUid'] = $applicationFields["PRO_UID"];
|
||||
$context['reportTable'] = $tableName;
|
||||
Bootstrap::registerMonolog('DeleteCases', 400, $e->getMessage(), $context);
|
||||
$message = $e->getMessage();
|
||||
$context = [
|
||||
'appUid' => $applicationUid,
|
||||
'proUid' => $applicationFields["PRO_UID"],
|
||||
'reportTable' => $tableName
|
||||
];
|
||||
Log::channel(':DeleteCases')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Route case
|
||||
*/
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Model\Application as ModelApplication;
|
||||
use ProcessMaker\Model\SubApplication as ModelSubApplication;
|
||||
|
||||
@@ -138,8 +135,8 @@ class Derivation
|
||||
|
||||
$arrayApplicationData = $this->case->loadCase($arrayData["APP_UID"]);
|
||||
|
||||
$arrayNextTask = array();
|
||||
$arrayNextTaskDefault = array();
|
||||
$arrayNextTask = [];
|
||||
$arrayNextTaskDefault = [];
|
||||
$i = 0;
|
||||
|
||||
$criteria = new Criteria("workflow");
|
||||
@@ -168,7 +165,7 @@ class Derivation
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$flagDefault = false;
|
||||
$aSecJoin = array();
|
||||
$aSecJoin = [];
|
||||
$count = 0;
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
@@ -228,7 +225,7 @@ class Derivation
|
||||
//Check Task GATEWAYTOGATEWAY, END-MESSAGE-EVENT, END-EMAIL-EVENT
|
||||
$arrayNextTaskBackup = $arrayNextTask;
|
||||
|
||||
$arrayNextTask = array();
|
||||
$arrayNextTask = [];
|
||||
$i = 0;
|
||||
foreach ($arrayNextTaskBackup as $value) {
|
||||
$arrayNextTaskData = $value;
|
||||
@@ -694,7 +691,7 @@ class Derivation
|
||||
}
|
||||
|
||||
//Element origin and dest
|
||||
$arrayElement = array();
|
||||
$arrayElement = [];
|
||||
$elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
|
||||
$arrayElementTaskRelationData = $elementTaskRelation->getElementTaskRelationWhere(
|
||||
[
|
||||
@@ -705,7 +702,7 @@ class Derivation
|
||||
true
|
||||
);
|
||||
if(is_null($arrayElementTaskRelationData)){
|
||||
$arrayOtherElement = array();
|
||||
$arrayOtherElement = [];
|
||||
$arrayOtherElement = $bpmn->getElementsBetweenElementOriginAndElementDest(
|
||||
$elementOriUid,
|
||||
"bpmnActivity",
|
||||
@@ -731,9 +728,9 @@ class Derivation
|
||||
$arrayEventExecute = ["BEFORE" => $flagEventExecuteBeforeGateway, "AFTER" => $flagEventExecuteAfterGateway];
|
||||
$positionEventExecute = "BEFORE";
|
||||
|
||||
$aContext = $this->context;
|
||||
$aContext['appUid'] = $applicationData["APP_UID"];
|
||||
$aContext['proUid'] = $applicationData["PRO_UID"];
|
||||
$context = $this->context;
|
||||
$context['appUid'] = $applicationData["APP_UID"];
|
||||
$context['proUid'] = $applicationData["PRO_UID"];
|
||||
if(sizeof($arrayElement)){
|
||||
foreach ($arrayElement as $value) {
|
||||
switch ($value['type']) {
|
||||
@@ -746,24 +743,26 @@ class Derivation
|
||||
//Message-Application throw
|
||||
$result = $messageApplication->create($applicationData["APP_UID"], $applicationData["PRO_UID"], $value['uid'], $applicationData);
|
||||
|
||||
$aContext['envUid'] = $value['uid'];
|
||||
$aContext['envType'] = $event->getEvnType();
|
||||
$aContext['envMarker'] = $event->getEvnMarker();
|
||||
$aContext['action'] = 'Message application throw';
|
||||
$context['envUid'] = $value['uid'];
|
||||
$context['envType'] = $event->getEvnType();
|
||||
$context['envMarker'] = $event->getEvnMarker();
|
||||
$context['action'] = 'Message application throw';
|
||||
//Logger
|
||||
Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log');
|
||||
$message = 'Case Derivation';
|
||||
Log::channel(':CaseDerivation')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
if (preg_match("/^(?:END|INTERMEDIATE)$/", $event->getEvnType()) && $event->getEvnMarker() === 'EMAIL') {
|
||||
//Email-Event throw
|
||||
$result = $emailEvent->sendEmail($applicationData["APP_UID"], $applicationData["PRO_UID"], $value['uid'], $applicationData, $tasId);
|
||||
|
||||
$aContext['envUid'] = $value['uid'];
|
||||
$aContext['envType'] = $event->getEvnType();
|
||||
$aContext['envMarker'] = $event->getEvnMarker();
|
||||
$aContext['action'] = 'Email event throw';
|
||||
$context['envUid'] = $value['uid'];
|
||||
$context['envType'] = $event->getEvnType();
|
||||
$context['envMarker'] = $event->getEvnMarker();
|
||||
$context['action'] = 'Email event throw';
|
||||
//Logger
|
||||
Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log');
|
||||
$message = 'Case Derivation';
|
||||
Log::channel(':CaseDerivation')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -845,7 +844,7 @@ class Derivation
|
||||
$nextTasks = $oRoute->mergeDataDerivation($tasks, $aPInformation, $rouType);
|
||||
|
||||
//Get all route types
|
||||
$aRouteTypes = array();
|
||||
$aRouteTypes = [];
|
||||
foreach ($aPInformation as $key => $value) {
|
||||
$aRouteTypes[$key]['ROU_NEXT_TASK'] = $value['ROU_NEXT_TASK'];
|
||||
$aRouteTypes[$key]['ROU_TYPE'] = $value['ROU_TYPE'];
|
||||
@@ -876,8 +875,8 @@ class Derivation
|
||||
function derivate(array $currentDelegation, array $nextDelegations, $removeList = true)
|
||||
{
|
||||
$this->sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined";
|
||||
$this->context = Bootstrap::getDefaultContextLog();
|
||||
$aContext = $this->context;
|
||||
$this->context = Bootstrap::context();
|
||||
$context = $this->context;
|
||||
$this->removeList = $removeList;
|
||||
$arrayDerivationResult = [];
|
||||
|
||||
@@ -893,8 +892,8 @@ class Derivation
|
||||
|
||||
//Get data for this DEL_INDEX current
|
||||
$appFields = $this->case->loadCase( $currentDelegation['APP_UID'], $currentDelegation['DEL_INDEX'] );
|
||||
$aContext['appUid'] = $currentDelegation['APP_UID'];
|
||||
$aContext['delIndex'] = $currentDelegation['DEL_INDEX'];
|
||||
$context['appUid'] = $currentDelegation['APP_UID'];
|
||||
$context['delIndex'] = $currentDelegation['DEL_INDEX'];
|
||||
|
||||
// Remove the fields that will update with the thread creation
|
||||
unset($appFields['APP_ROUTING_DATA']);
|
||||
@@ -923,7 +922,7 @@ class Derivation
|
||||
$currentDelegation["TAS_MI_COMPLETE_VARIABLE"] = $task->getTasMiCompleteVariable();
|
||||
$currentDelegation["TAS_MI_INSTANCE_VARIABLE"] = $task->getTasMiInstanceVariable();
|
||||
|
||||
$arrayNextDerivation = array();
|
||||
$arrayNextDerivation = [];
|
||||
$flagFirstIteration = true;
|
||||
|
||||
foreach ($nextDelegations as $nextDel) {
|
||||
@@ -965,7 +964,7 @@ class Derivation
|
||||
|
||||
$this->flagUpdateList = true;
|
||||
|
||||
$aContext['tasUid'] = $nextDel['TAS_UID'];
|
||||
$context['tasUid'] = $nextDel['TAS_UID'];
|
||||
switch ($nextDel['TAS_UID']) {
|
||||
case TASK_FINISH_PROCESS:
|
||||
$this->finishProcess(
|
||||
@@ -973,7 +972,7 @@ class Derivation
|
||||
$nextDel,
|
||||
$appFields,
|
||||
$flagFirstIteration,
|
||||
$aContext
|
||||
$context
|
||||
);
|
||||
break;
|
||||
case TASK_FINISH_TASK:
|
||||
@@ -983,7 +982,7 @@ class Derivation
|
||||
$appFields,
|
||||
$flagFirstIteration,
|
||||
$flagTaskAssignTypeIsMultipleInstance,
|
||||
$aContext
|
||||
$context
|
||||
);
|
||||
break;
|
||||
default:
|
||||
@@ -1354,7 +1353,7 @@ class Derivation
|
||||
|
||||
if (isset($aDeriveTasks[1])) {
|
||||
if ($aDeriveTasks[1]['ROU_TYPE'] != 'SELECT') {
|
||||
$nextDelegations2 = array();
|
||||
$nextDelegations2 = [];
|
||||
foreach ($aDeriveTasks as $aDeriveTask) {
|
||||
$nextDelegations2[] = array(
|
||||
'TAS_UID' => $aDeriveTask['NEXT_TASK']['TAS_UID'],
|
||||
@@ -1869,7 +1868,7 @@ class Derivation
|
||||
{
|
||||
try {
|
||||
if ($nextDel['TAS_RECEIVE_LAST_EMAIL'] == 'TRUE') {
|
||||
$taskData = array();
|
||||
$taskData = [];
|
||||
$userLogged = $this->userLogged->load($appFields['APP_DATA']['USER_LOGGED']);
|
||||
$fromName = $userLogged['USR_FIRSTNAME'] . ' ' . $userLogged['USR_LASTNAME'];
|
||||
$sFromData = $fromName . ($userLogged['USR_EMAIL'] != '' ? ' <' . $userLogged['USR_EMAIL'] . '>' : '');
|
||||
@@ -1899,10 +1898,10 @@ class Derivation
|
||||
* @param array $appFields
|
||||
* @param boolean $flagFirstIteration
|
||||
* @param boolean $flagTaskAssignTypeIsMultipleInstance
|
||||
* @param array $aContext
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function finishTask($currentDelegation, $nextDel, $appFields, $flagFirstIteration = true, $flagTaskAssignTypeIsMultipleInstance = false, $aContext = array()) {
|
||||
public function finishTask($currentDelegation, $nextDel, $appFields, $flagFirstIteration = true, $flagTaskAssignTypeIsMultipleInstance = false, $context = []) {
|
||||
$iAppThreadIndex = $appFields['DEL_THREAD'];
|
||||
$this->case->closeAppThread($currentDelegation['APP_UID'], $iAppThreadIndex);
|
||||
if (isset($nextDel["TAS_UID_DUMMY"])) {
|
||||
@@ -1940,9 +1939,10 @@ class Derivation
|
||||
);
|
||||
}
|
||||
}
|
||||
$aContext['action'] = 'finish-task';
|
||||
$context['action'] = 'finish-task';
|
||||
//Logger
|
||||
Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log');
|
||||
$message = 'Case Derivation';
|
||||
Log::channel(':CaseDerivation')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1952,10 +1952,10 @@ class Derivation
|
||||
* @param array $nextDel
|
||||
* @param array $appFields
|
||||
* @param boolean $flagFirstIteration
|
||||
* @param array $aContext
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
public function finishProcess($currentDelegation, $nextDel, $appFields, $flagFirstIteration = true, $aContext = array()){
|
||||
public function finishProcess($currentDelegation, $nextDel, $appFields, $flagFirstIteration = true, $context = []){
|
||||
/*Close all delegations of $currentDelegation['APP_UID'] */
|
||||
$this->case->closeAllDelegations( $currentDelegation['APP_UID'] );
|
||||
$this->case->closeAllThreads( $currentDelegation['APP_UID'] );
|
||||
@@ -1987,9 +1987,10 @@ class Derivation
|
||||
);
|
||||
}
|
||||
}
|
||||
$aContext['action'] = 'end-process';
|
||||
$context['action'] = 'end-process';
|
||||
//Logger
|
||||
Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log');
|
||||
$message = 'Case Derivation';
|
||||
Log::channel(':CaseDerivation')->info($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2003,7 +2004,7 @@ class Derivation
|
||||
*/
|
||||
public function getNextInfoSubProcess($nextDel, $proUid)
|
||||
{
|
||||
$newNextDel = array();
|
||||
$newNextDel = [];
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(SubProcessPeer::PRO_PARENT, $proUid);
|
||||
$oCriteria->add(SubProcessPeer::TAS_PARENT, $nextDel['TAS_PARENT']);
|
||||
@@ -2082,7 +2083,7 @@ class Derivation
|
||||
*/
|
||||
public function canRouteTypeSecJoin($flagMultipleInstance, $flagTypeMultipleInstance, $currentDelegation, $appFields, $nextDel)
|
||||
{
|
||||
$arrayOpenThread = ($flagMultipleInstance && $flagTypeMultipleInstance)? $this->case->searchOpenPreviousTasks($currentDelegation["TAS_UID"], $currentDelegation["APP_UID"]) : array();
|
||||
$arrayOpenThread = ($flagMultipleInstance && $flagTypeMultipleInstance)? $this->case->searchOpenPreviousTasks($currentDelegation["TAS_UID"], $currentDelegation["APP_UID"]) : [];
|
||||
|
||||
if (
|
||||
$flagMultipleInstance
|
||||
@@ -2220,7 +2221,7 @@ class Derivation
|
||||
*/
|
||||
public function routePrepareInformationNextTask($currentDelegation, $iNewDelIndex, $nextDel)
|
||||
{
|
||||
$nextDelegationsAux = array();
|
||||
$nextDelegationsAux = [];
|
||||
$taskNextDelNextDelRouType = "";
|
||||
$i = 0;
|
||||
//Get for $nextDel["TAS_UID"] your next Task
|
||||
@@ -2296,7 +2297,7 @@ class Derivation
|
||||
* @param boolean $flagFirstIteration
|
||||
* @return void
|
||||
*/
|
||||
public function doRouteWithoutThread($appFields, $currentDelegation, $nextDel, $arraySiblings = array(), $flagMultipleInstance = false, $flagTypeMultipleInstance = false, $flagFirstIteration = false)
|
||||
public function doRouteWithoutThread($appFields, $currentDelegation, $nextDel, $arraySiblings = [], $flagMultipleInstance = false, $flagTypeMultipleInstance = false, $flagFirstIteration = false)
|
||||
{
|
||||
$iAppThreadIndex = $appFields['DEL_THREAD'];
|
||||
$routeType = $currentDelegation["ROU_TYPE"];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use \ProcessMaker\BusinessModel\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\BusinessModel\User;
|
||||
|
||||
/**
|
||||
* class.ldapAdvanced.php
|
||||
@@ -1127,10 +1128,12 @@ class LdapAdvanced
|
||||
BasePeer::doUpdate($c1, $c2, $con);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context["action"] = "ldapSynchronize";
|
||||
$context["authSource"] = $arrayAuthSource;
|
||||
Bootstrap::registerMonolog("ldapSynchronize", 400, $e->getMessage(), $context, $context["workspace"], "processmaker.log");
|
||||
$context = [
|
||||
"action" => "ldapSynchronize",
|
||||
"authSource" => $arrayAuthSource
|
||||
];
|
||||
$message = $e->getMessage();
|
||||
Log::channel(':ldapSynchronize')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
//Check ldap connection for user
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\BusinessModel\DynaForm\SuggestTrait;
|
||||
use ProcessMaker\BusinessModel\Cases;
|
||||
@@ -78,7 +79,7 @@ class PmDynaform
|
||||
public function __construct($fields = [])
|
||||
{
|
||||
$this->sysSys = (!empty(config("system.workspace"))) ? config("system.workspace") : "Undefined";
|
||||
$this->context = \Bootstrap::getDefaultContextLog();
|
||||
$this->context = Bootstrap::context();
|
||||
$this->dataSources = array("database", "dataVariable");
|
||||
$this->pathRTLCss = '/lib/pmdynaform/build/css/PMDynaform-rtl.css';
|
||||
$this->serverConf = ServerConf::getSingleton();
|
||||
@@ -938,18 +939,16 @@ class PmDynaform
|
||||
|
||||
$this->context["action"] = "execute-sql" . $type;
|
||||
$this->context["sql"] = $sql;
|
||||
\Bootstrap::registerMonolog("sqlExecution", 200, "Sql Execution", $this->context, $this->sysSys, "processmaker.log");
|
||||
$message = 'Sql Execution';
|
||||
Log::channel(':sqlExecution')->info($message, Bootstrap::context($this->context));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->context["action"] = "execute-sql" . $type;
|
||||
$this->context["exception"] = (array) $e;
|
||||
$this->lastQueryError = $e;
|
||||
\Bootstrap::registerMonolog("sqlExecution",
|
||||
400,
|
||||
"Sql Execution",
|
||||
$this->basicExceptionData($e, $sql),
|
||||
$this->sysSys,
|
||||
"processmaker.log");
|
||||
$message = 'Sql Execution';
|
||||
$context = $this->basicExceptionData($e, $sql);
|
||||
Log::channel(':sqlExecution')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
@@ -2385,14 +2384,13 @@ class PmDynaform
|
||||
$jsonData = G::json_encode($json);
|
||||
|
||||
//Log
|
||||
\Bootstrap::registerMonolog(
|
||||
'RenderDynaForm',
|
||||
400,
|
||||
'JSON encoded string error ' . $jsonLastError . ': ' . $jsonLastErrorMsg,
|
||||
['token' => $token, 'projectUid' => $this->record['PRO_UID'], 'dynaFormUid' => $this->record['DYN_UID']],
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
$message = 'JSON encoded string error ' . $jsonLastError . ': ' . $jsonLastErrorMsg;
|
||||
$context = [
|
||||
'token' => $token,
|
||||
'projectUid' => $this->record['PRO_UID'],
|
||||
'dynaFormUid' => $this->record['DYN_UID']
|
||||
];
|
||||
Log::channel(':RenderDynaForm')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
//Return
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\BusinessModel\EmailEvent;
|
||||
use ProcessMaker\BusinessModel\Variable as BmVariable;
|
||||
use ProcessMaker\Core\System;
|
||||
@@ -4491,7 +4492,8 @@ class Processes
|
||||
try {
|
||||
$result = $scriptTask->create($processUid, $record);
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog('DataError', 400, $e->getMessage(), $record, config("system.workspace"), 'processmaker.log');
|
||||
$message = $e->getMessage();
|
||||
Log::channel(':DataError')->error($message, Bootstrap::context($record));
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
@@ -5406,16 +5408,14 @@ class Processes
|
||||
}
|
||||
if ($bytesSaved != $fsContent) {
|
||||
$channel = "writingMailTemplate";
|
||||
$context = \Bootstrap::getDefaultContextLog();
|
||||
$context = [];
|
||||
$context['action'] = $channel;
|
||||
if (defined("SYS_CURRENT_URI") && defined("SYS_CURRENT_PARMS")) {
|
||||
$context['url'] = SYS_CURRENT_URI . '?' . SYS_CURRENT_PARMS;
|
||||
}
|
||||
$context['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '';
|
||||
$sysSys = !empty(config("system.workspace")) ? config("system.workspace") : "Undefined";
|
||||
$message = 'The imported template has a number of byes different than the original template, please verify if the file \'' . $newFileName . '\' is correct.';
|
||||
$level = 400;
|
||||
Bootstrap::registerMonolog($channel, $level, $message, $context, $sysSys, 'processmaker.log');
|
||||
Log::channel(':' . $channel)->error($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use App\Jobs\GenerateReportTable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\JobsManager;
|
||||
use ProcessMaker\Model\Application;
|
||||
|
||||
@@ -614,14 +615,12 @@ class ReportTables
|
||||
try {
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog(
|
||||
'sqlExecution',
|
||||
400,
|
||||
'Sql Execution',
|
||||
['sql' => $sQuery, 'error' => $e->getMessage()],
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
$message = 'Sql Execution';
|
||||
$context = [
|
||||
'sql' => $sQuery,
|
||||
'error' => $e->getMessage()
|
||||
];
|
||||
Log::channel(':sqlExecution')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -666,14 +665,12 @@ class ReportTables
|
||||
try {
|
||||
$rs = $stmt->executeQuery($sQuery);
|
||||
} catch (Exception $e) {
|
||||
Bootstrap::registerMonolog(
|
||||
'sqlExecution',
|
||||
400,
|
||||
'Sql Execution',
|
||||
['sql' => $sQuery, 'error' => $e->getMessage()],
|
||||
config("system.workspace"),
|
||||
'processmaker.log'
|
||||
);
|
||||
$message = 'Sql Execution';
|
||||
$context = [
|
||||
'sql' => $sQuery,
|
||||
'error' => $e->getMessage()
|
||||
];
|
||||
Log::channel(':sqlExecution')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* spoolRun - brief send email from the spool database, and see if we have all the addresses we send to.
|
||||
*
|
||||
* @author Ian K Armstrong <ika@[REMOVE_THESE_CAPITALS]openmail.cc>
|
||||
* @copyright Copyright (c) 2007, Ian K Armstrong
|
||||
* @license http://www.opensource.org/licenses/gpl-3.0.html GNU Public License
|
||||
* @link http://www.openmail.cc
|
||||
*/
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
/**
|
||||
@@ -362,11 +355,13 @@ class SpoolRun
|
||||
$appMessage->setAppMsgSendDate(date('Y-m-d H:i:s'));
|
||||
$appMessage->save();
|
||||
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context["action"] = "Send email";
|
||||
$context["appMsgUid"] = $this->getAppMsgUid();
|
||||
$context["appUid"] = $this->getAppUid();
|
||||
Bootstrap::registerMonolog("SendEmail", 400, $msgError, $context);
|
||||
$message = $msgError;
|
||||
$context = [
|
||||
"action" => "Send email",
|
||||
"appMsgUid" => $this->getAppMsgUid(),
|
||||
"appUid" => $this->getAppUid()
|
||||
];
|
||||
Log::channel(':SendEmail')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\BusinessModel\Process as BmProcess;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
use ProcessMaker\ChangeLog\ChangeLog;
|
||||
@@ -4934,7 +4935,7 @@ class WorkspaceTools
|
||||
}
|
||||
}
|
||||
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context = Bootstrap::context();
|
||||
$case = new Cases();
|
||||
|
||||
//select cases for this Process, ordered by APP_NUMBER
|
||||
@@ -5002,7 +5003,8 @@ class WorkspaceTools
|
||||
$context["message"] = $e->getMessage();
|
||||
$context["tableName"] = $tableName;
|
||||
$context["appUid"] = $application->APP_UID;
|
||||
Bootstrap::registerMonolog("sqlExecution", 500, "Sql Execution", $context, $context["workspace"], "processmaker.log");
|
||||
$message = 'Sql Execution';
|
||||
Log::channel(':sqlExecution')->critical($message, Bootstrap::context($context));
|
||||
}
|
||||
unset($obj);
|
||||
}
|
||||
@@ -5020,7 +5022,8 @@ class WorkspaceTools
|
||||
$context["message"] = $e->getMessage();
|
||||
$context["tableName"] = $tableName;
|
||||
$context["appUid"] = $application->APP_UID;
|
||||
Bootstrap::registerMonolog("sqlExecution", 500, "Sql Execution", $context, $context["workspace"], "processmaker.log");
|
||||
$message = 'Sql Execution';
|
||||
Log::channel(':sqlExecution')->critical($message, Bootstrap::context($context));
|
||||
}
|
||||
unset($obj);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
//
|
||||
// License: LGPL, see LICENSE
|
||||
////////////////////////////////////////////////////
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
@@ -242,9 +243,6 @@ function literalDate ($date, $lang = 'en')
|
||||
*/
|
||||
function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter = array())
|
||||
{
|
||||
$sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined";
|
||||
$aContext = \Bootstrap::getDefaultContextLog();
|
||||
|
||||
// This means the DBConnectionUID is not loaded yet, so we'll force DbConnections::loadAdditionalConnections
|
||||
if (is_null(config('database.connections.' . $DBConnectionUID . '.driver'))) {
|
||||
// Force to load the external connections
|
||||
@@ -356,17 +354,21 @@ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter
|
||||
}
|
||||
}
|
||||
//Logger
|
||||
$aContext['action'] = 'execute-query';
|
||||
$aContext['sql'] = $SqlStatement;
|
||||
\Bootstrap::registerMonolog('sqlExecution', 200, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
|
||||
|
||||
$message = 'Sql Execution';
|
||||
$context = [
|
||||
'action' => 'execute-query',
|
||||
'sql' => $SqlStatement
|
||||
];
|
||||
Log::channel(':sqlExecution')->info($message, Bootstrap::context($context));
|
||||
return $result;
|
||||
} catch (SQLException $sqle) {
|
||||
//Logger
|
||||
$aContext['action'] = 'execute-query';
|
||||
$aContext['SQLExceptionMessage'] = $sqle->getMessage();
|
||||
\Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', $aContext, $sysSys, 'processmaker.log');
|
||||
|
||||
$message = 'Sql Execution';
|
||||
$context = [
|
||||
'action' => 'execute-query',
|
||||
'SQLExceptionMessage' => $sqle->getMessage()
|
||||
];
|
||||
Log::channel(':sqlExecution')->error($message, Bootstrap::context($context));
|
||||
$con->rollback();
|
||||
throw $sqle;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use App\Jobs\GenerateReportTable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\JobsManager;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Model\Application;
|
||||
@@ -1033,10 +1034,9 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
if ($externalResultSet->next()) {
|
||||
$stringCount = $externalResultSet->getInt(1);
|
||||
}
|
||||
} catch (Exception $externalException) {
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context = array_merge($context, $row);
|
||||
Bootstrap::registerMonolog("additional tables", 400, $externalException->getMessage(), $context);
|
||||
} catch (Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
Log::channel(':additional tables')->error($message, Bootstrap::context($row));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
require_once 'classes/model/om/BaseAppAssignSelfServiceValueGroup.php';
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'APP_ASSIGN_SELF_SERVICE_VALUE_GROUP' table.
|
||||
* You should add additional methods to this class to meet the
|
||||
@@ -48,10 +50,12 @@ class AppAssignSelfServiceValueGroup extends BaseAppAssignSelfServiceValueGroup
|
||||
{
|
||||
$object = $this->getTypeUserOrGroup($id);
|
||||
if ($object->id === -1) {
|
||||
$dataLog = Bootstrap::getDefaultContextLog();
|
||||
$dataLog['ASSIGNEE_ID'] = $id;
|
||||
$dataLog['ASSIGNEE_TYPE'] = $object->type;
|
||||
Bootstrap::registerMonolog('AssignSelfServiceValue', 300, 'Invalid identifier value for Assign Self Service Value', $dataLog, $dataLog['workspace'], 'processmaker.log');
|
||||
$message = 'Invalid identifier value for Assign Self Service Value';
|
||||
$context = [
|
||||
'ASSIGNEE_ID' => $id,
|
||||
'ASSIGNEE_TYPE' => $object->type
|
||||
];
|
||||
Log::channel(':AssignSelfServiceValue')->warning($message, Bootstrap::context($context));
|
||||
} else {
|
||||
$sql = "INSERT INTO "
|
||||
. AppAssignSelfServiceValueGroupPeer::TABLE_NAME
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
@@ -230,7 +231,9 @@ class Designer extends Controller
|
||||
}
|
||||
Tracker::authentication($_SESSION['CASE'], $_SESSION['PIN']);
|
||||
} catch (\Exception $e) {
|
||||
Bootstrap::registerMonolog('CaseTracker', 400, $e->getMessage(), [], config("system.workspace"), 'processmaker.log');
|
||||
$message = $e->getMessage();
|
||||
$context = [];
|
||||
Log::channel(':CaseTracker')->error($message, Bootstrap::context($context));
|
||||
\G::header('Location: /errors/error403.php');
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Model\AdditionalTables as AdditionalTablesModel;
|
||||
use ProcessMaker\Validation\ExceptionRestApi;
|
||||
@@ -1221,11 +1222,13 @@ class pmTablesProxy extends HttpProxyController
|
||||
$additionalTables->populateReportTable($table['ADD_TAB_NAME'], PmTable::resolveDbSource($table['DBS_UID']), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'], $table['ADD_TAB_UID']);
|
||||
$result->message = G::LoadTranslation("ID_THE_REPORT_TABLE_IS_REGENERATING_PLEASE_COME_BACK_IN_A_FEW_MINUTES");
|
||||
} catch (Exception $e) {
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context['proUid'] = $table['PRO_UID'];
|
||||
$context['tableName'] = $table['ADD_TAB_NAME'];
|
||||
$context['message'] = $e->getMessage();
|
||||
Bootstrap::registerMonolog('dataReport', 500, 'Generation of data report could not be completed', $context, $context['workspace'], 'processmaker.log');
|
||||
$message = 'Generation of data report could not be completed';
|
||||
$context = [
|
||||
'proUid' => $table['PRO_UID'],
|
||||
'tableName' => $table['ADD_TAB_NAME'],
|
||||
'message' => $e->getMessage()
|
||||
];
|
||||
Log::channel(':dataReport')->critical($message, Bootstrap::context($context));
|
||||
|
||||
$result->message = 'Generation of data report could not be completed. Please check the processmaker.log for more details.';
|
||||
$result->success = false;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ldapadvancedClassCron
|
||||
{
|
||||
public $deletedRemoved = 0; //Users in the removed OU
|
||||
@@ -360,10 +363,12 @@ class ldapadvancedClassCron
|
||||
//Update Users data based on the LDAP Server
|
||||
$plugin->usersUpdateData($arrayAuthenticationSourceData["AUTH_SOURCE_UID"]);
|
||||
} catch (Exception $e) {
|
||||
$context = Bootstrap::getDefaultContextLog();
|
||||
$context["action"] = "ldapSynchronize";
|
||||
$context["authSource"] = $arrayAuthenticationSourceData;
|
||||
Bootstrap::registerMonolog("ldapSynchronize", 400, $e->getMessage(), $context, $context["workspace"], "processmaker.log");
|
||||
$message = $e->getMessage();
|
||||
$context = [
|
||||
'action' => 'ldapSynchronize',
|
||||
'authSource' => $arrayAuthenticationSourceData
|
||||
];
|
||||
Log::channel(':ldapSynchronize')->error($message, Bootstrap::context($context));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -4059,8 +4061,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()
|
||||
@@ -4079,8 +4085,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;
|
||||
@@ -1494,12 +1447,9 @@ class TimerEvent
|
||||
,'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");
|
||||
@@ -1513,12 +1463,9 @@ class TimerEvent
|
||||
,'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++;
|
||||
@@ -1780,12 +1718,9 @@ class TimerEvent
|
||||
,'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");
|
||||
|
||||
@@ -195,12 +195,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();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\Core\AppEvent;
|
||||
use ProcessMaker\Core\JobsManager;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
@@ -826,13 +827,22 @@ if (substr(SYS_COLLECTION, 0, 8) === 'gulliver') {
|
||||
$isWebEntry = \ProcessMaker\BusinessModel\WebEntry::isWebEntry(SYS_COLLECTION, $phpFile);
|
||||
if (\Bootstrap::getDisablePhpUploadExecution() === 1 && !$isWebEntry) {
|
||||
$message = \G::LoadTranslation('ID_THE_PHP_FILES_EXECUTION_WAS_DISABLED');
|
||||
\Bootstrap::registerMonologPhpUploadExecution('phpExecution', 550, $message, $phpFile);
|
||||
$context = [
|
||||
'filename' => $phpFile,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpExecution')->alert($message, \Bootstrap::context($context));
|
||||
echo $message;
|
||||
die();
|
||||
} else {
|
||||
//Backward compatibility: Preload PmDynaform for old generated webentry files.
|
||||
class_exists('PmDynaform');
|
||||
\Bootstrap::registerMonologPhpUploadExecution('phpExecution', 200, 'Php Execution', $phpFile);
|
||||
$message = 'Php Execution';
|
||||
$context = [
|
||||
'filename' => $phpFile,
|
||||
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||
];
|
||||
Log::channel(':phpExecution')->info($message, \Bootstrap::context($context));
|
||||
}
|
||||
|
||||
$avoidChangedWorkspaceValidation = true;
|
||||
|
||||
Reference in New Issue
Block a user