N°4261 - New log handler dedicated to Exceptions & use of it in the portal's Exception listener

Such Exceptions are triggered with a Warning level and default the minimum default level in order to write in DB is above, so the behavior is not modified:
 - logs are written in errors.log (with a warning elvel instead of an error)
 - logs are not written in DB unless `log_level_min.write_in_db` is changed
This commit is contained in:
bruno-ds
2021-09-14 16:43:48 +02:00
parent b46357a1bd
commit 5d23a250ae
6 changed files with 384 additions and 7 deletions

View File

@@ -86,7 +86,7 @@ class ExceptionListener implements ContainerAwareInterface
}
// Log exception in iTop log
IssueLog::Error($sErrorTitle.': '.$sErrorMessage);
\ExceptionLog::FromException($oException, ['uri' => $oEvent->getRequest()->getUri()]);
// Prepare data for template
$aData = array(
@@ -104,8 +104,7 @@ class ExceptionListener implements ContainerAwareInterface
else
{
$oResponse = new Response();
$oResponse->setContent($this->oContainer->get('twig')->render('itop-portal-base/portal/templates/errors/layout.html.twig',
$aData));
$oResponse->setContent($this->oContainer->get('twig')->render('itop-portal-base/portal/templates/errors/layout.html.twig', $aData));
}
$oResponse->setStatusCode($iStatusCode);