} restore_error_handler(); if (!is_resource($stream)) { $this->stream = null; throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened in append mode: '.$this->errorMessage, $url) . Utils::getRecordMessageForException($record)); } stream_set_chunk_size($stream, $this->streamChunkSize); $this->stream = $stream; } if ($this->nextRotation <= $record['datetime']) { $this->mustRotate = true; $this->close(); } parent::write($record); } /** * Rotates the files. */ $record = $this->processRecord($record); } $record['formatted'] = $this->getFormatter()->format($record); $this->write($record); return false === $this->bubble; } /** } } // once the record exists, send it to all handlers as long as the bubbling chain is not interrupted try { if (true === $handler->handle($record)) { break; } } catch (Throwable $e) { $this->handleException($e, $record); * @param string|Stringable $message The log message * @param mixed[] $context The log context */ public function critical($message, array $context = []): void { $this->addRecord(static::CRITICAL, (string) $message, $context); } /** * Adds a log record at the ALERT level. * { if (null !== $this->logger) { if (null !== $logLevel) { $this->logger->log($logLevel, $message, ['exception' => $exception]); } elseif (!$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500) { $this->logger->critical($message, ['exception' => $exception]); } else { $this->logger->error($message, ['exception' => $exception]); } } } break; } $e = FlattenException::createFromThrowable($throwable); $this->logException($throwable, sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', $e->getClass(), $e->getMessage(), $e->getFile(), $e->getLine()), $logLevel); } public function onKernelException(ExceptionEvent $event) { if (null === $this->controller) { foreach ($listeners as $listener) { if ($stoppable && $event->isPropagationStopped()) { break; } $listener($event, $eventName, $this); } } /** * Sorts the internal list of listeners for the given event by priority. } else { $listeners = $this->getListeners($eventName); } if ($listeners) { $this->callListeners($listeners, $eventName, $event); } return $event; } ) {
}
public function dispatch(object $event, string $eventName = null): object
{
$event = parent::dispatch($event, $eventName);
if ($event instanceof ConfigurableEvent && $this->site->hasSite()) {
if (!$eventName) {
$eventName = get_class($event);
}
$this->runEvents($event, (string)$eventName);
* @throws \Exception */ private function handleThrowable(\Throwable $e, Request $request, int $type): Response { $event = new ExceptionEvent($this, $request, $type, $e); $this->dispatcher->dispatch($event, KernelEvents::EXCEPTION); // a listener might have replaced the exception $e = $event->getThrowable(); if (!$event->hasResponse()) { if ($pop = $request !== $this->requestStack->getMainRequest()) { $this->requestStack->push($request); } try { $response = $this->handleThrowable($exception, $request, self::MAIN_REQUEST); } finally { if ($pop) { $this->requestStack->pop(); } } if ($hasRun) { throw $e; } $hasRun = true; $kernel->terminateWithException($e, $request); }; } } elseif ($event instanceof ConsoleEvent && $app = $event->getCommand()->getApplication()) { $output = $event->getOutput(); if ($output instanceof ConsoleOutputInterface) { $this->exceptionHandler = null; } try { if (null !== $exceptionHandler) { $exceptionHandler($exception); return; } $handlerException ??= $exception; } catch (\Throwable $handlerException) {|
UnexpectedValueException
|
|---|
UnexpectedValueException:
The stream or file "/var/www/html/apps/cms/var/log/prod-2026-07-10.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: Uncaught PHP Exception UnexpectedValueException: "The stream or file "/var/www/html/apps/cms/var/log/prod-2026-07-10.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: Uncaught PHP Exception SpotifyWebAPI\SpotifyWebAPIException: "Active premium subscription required for the owner of the app. When the subscription status changes, it can take a few hours before requests are allowed again." at /var/www/html/apps/cms/vendor/jwilsson/spotify-web-api-php/src/Request.php line 59
Context: {"exception":{}}" at /var/www/html/apps/cms/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php line 146
Context: {"exception":{}}
at /var/www/html/apps/cms/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:146
at Monolog\Handler\StreamHandler->write()
(/var/www/html/apps/cms/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php:125)
at Monolog\Handler\RotatingFileHandler->write()
(/var/www/html/apps/cms/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php:48)
at Monolog\Handler\AbstractProcessingHandler->handle()
(/var/www/html/apps/cms/vendor/monolog/monolog/src/Monolog/Logger.php:399)
at Monolog\Logger->addRecord()
(/var/www/html/apps/cms/vendor/monolog/monolog/src/Monolog/Logger.php:663)
at Monolog\Logger->critical()
(/var/www/html/apps/cms/vendor/symfony/http-kernel/EventListener/ErrorListener.php:164)
at Symfony\Component\HttpKernel\EventListener\ErrorListener->logException()
(/var/www/html/apps/cms/vendor/symfony/http-kernel/EventListener/ErrorListener.php:78)
at Symfony\Component\HttpKernel\EventListener\ErrorListener->logKernelException()
(/var/www/html/apps/cms/vendor/symfony/event-dispatcher/EventDispatcher.php:220)
at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
(/var/www/html/apps/cms/vendor/symfony/event-dispatcher/EventDispatcher.php:56)
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
(/var/www/html/apps/cms/vendor/kingapp/event/Service/EventDispatcher.php:30)
at KingApp\EventBundle\Service\EventDispatcher->dispatch()
(/var/www/html/apps/cms/vendor/symfony/http-kernel/HttpKernel.php:223)
at Symfony\Component\HttpKernel\HttpKernel->handleThrowable()
(/var/www/html/apps/cms/vendor/symfony/http-kernel/HttpKernel.php:114)
at Symfony\Component\HttpKernel\HttpKernel->terminateWithException()
(/var/www/html/apps/cms/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php:131)
at Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::Symfony\Component\HttpKernel\EventListener\{closure}()
(/var/www/html/apps/cms/vendor/symfony/error-handler/ErrorHandler.php:537)
at Symfony\Component\ErrorHandler\ErrorHandler->handleException()
|