![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/CoreBundle/EventListener/ |
<?php declare(strict_types=1); namespace Mautic\CoreBundle\EventListener; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Event\ConsoleErrorEvent; class ConsoleErrorListener { public function __construct( private LoggerInterface $logger ) { } public function onConsoleError(ConsoleErrorEvent $event): void { $command = $event->getCommand(); $exception = $event->getError(); // Log error with trace $message = sprintf( '%s: %s (uncaught exception) at %s line %s while running console command `%s`%s', $exception::class, $exception->getMessage(), $exception->getFile(), $exception->getLine(), empty($command) ? 'UNKNOWN' : $command->getName(), "\n[stack trace]\n".$exception->getTraceAsString() ); $this->logger->error($message); } }