Skip to content
Snippets Groups Projects
Commit ce7cf5f9 authored by Ronny Perinke's avatar Ronny Perinke Committed by Anja Leichsenring
Browse files

[TASK] Write correct error level into `sys_log` table

* PHP exceptions were logged with level "info"
  in the `sys_log` table
* PHP errors were logged with wrong (numeric)
  error level in the `sys_log` table

Only values from `\Psr\Log\LogLevel` are allowed
and usable. Numeric values can not be used or
filtered in BeLog backend module.

Releases: main, 12.4, 11.5
Resolves: #100830
Change-Id: Ie35fe291ac74edd4173e096b8d12609d32c45e02
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79116


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: default avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 4a5eee6b
Branches
Tags
No related merge requests found
......@@ -167,6 +167,7 @@ abstract class AbstractExceptionHandler implements ExceptionHandlerInterface, Si
'channel' => SystemLogType::toChannel(SystemLogType::ERROR),
'action' => SystemLogGenericAction::UNDEFINED,
'error' => SystemLogErrorClassification::SYSTEM_ERROR,
'level' => SystemLogType::toLevel(SystemLogType::ERROR),
'details_nr' => 0,
'details' => str_replace('%', '%%', $logMessage),
'log_data' => empty($data) ? '' : serialize($data),
......
......@@ -248,19 +248,6 @@ class ErrorHandler implements ErrorHandlerInterface, LoggerAwareInterface
}
}
switch ($logLevel) {
case LogLevel::ERROR:
$severity = 2;
break;
case LogLevel::WARNING:
$severity = 1;
break;
case LogLevel::NOTICE:
default:
$severity = 0;
break;
}
$connection->insert(
'sys_log',
[
......@@ -269,7 +256,7 @@ class ErrorHandler implements ErrorHandlerInterface, LoggerAwareInterface
'channel' => SystemLogType::toChannel(SystemLogType::ERROR),
'action' => SystemLogGenericAction::UNDEFINED,
'error' => SystemLogErrorClassification::SYSTEM_ERROR,
'level' => $severity,
'level' => $logLevel,
'details_nr' => 0,
'details' => str_replace('%', '%%', $logMessage),
'log_data' => empty($data) ? '' : serialize($data),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment