Improved exception logging
This commit is contained in:
parent
67c9d82931
commit
de42f2e8bf
3 changed files with 13 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
## 2.5.3
|
||||
+ Fixed bad css loading on Firefox (#35).
|
||||
+ Fixed wrong style for publish/unpublish button.
|
||||
+ Improved exception stacktrace logging.
|
||||
|
||||
## v2.5.2
|
||||
+ Improved session handling.
|
||||
+ Fixed telegram share not working.
|
||||
|
|
|
@ -53,7 +53,7 @@ abstract class Controller
|
|||
try {
|
||||
$totalSize += $filesystem->getSize($media->storage_path);
|
||||
} catch (FileNotFoundException $e) {
|
||||
$this->logger->error('Error calculating file size', [$e->getTraceAsString()]);
|
||||
$this->logger->error('Error calculating file size', ['exception' => $e]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,11 @@ $container['logger'] = function ($container) {
|
|||
$logger = new Logger('app');
|
||||
|
||||
$streamHandler = new RotatingFileHandler(BASE_DIR . 'logs/log.txt', 10, Logger::DEBUG);
|
||||
$streamHandler->setFormatter(new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n", "Y-m-d H:i:s", true));
|
||||
|
||||
$lineFormatter = new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n", "Y-m-d H:i:s");
|
||||
$lineFormatter->includeStacktraces(true);
|
||||
|
||||
$streamHandler->setFormatter($lineFormatter);
|
||||
|
||||
$logger->pushHandler($streamHandler);
|
||||
|
||||
|
@ -103,7 +107,7 @@ $container['view'] = function ($container) use (&$config) {
|
|||
|
||||
$container['phpErrorHandler'] = function ($container) {
|
||||
return function (Request $request, Response $response, Throwable $error) use (&$container) {
|
||||
$container->logger->critical('Fatal runtime error during app execution', [$error, $error->getTraceAsString()]);
|
||||
$container->logger->critical('Fatal runtime error during app execution', ['exception' => $error]);
|
||||
return $container->view->render($response->withStatus(500), 'errors/500.twig', ['exception' => $error]);
|
||||
};
|
||||
};
|
||||
|
@ -119,7 +123,7 @@ $container['errorHandler'] = function ($container) {
|
|||
return $container->view->render($response->withStatus(403), 'errors/403.twig');
|
||||
}
|
||||
|
||||
$container->logger->critical('Fatal exception during app execution', [$exception, $exception->getTraceAsString()]);
|
||||
$container->logger->critical('Fatal exception during app execution', ['exception' => $exception]);
|
||||
return $container->view->render($response->withStatus(500), 'errors/500.twig', ['exception' => $exception]);
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue