PMCORE-1335 ProcessMaker core should be use the native Laravel log mechanism.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user