From 3391ac2fe2102844a349c43ac644ee16a5b80cb9 Mon Sep 17 00:00:00 2001 From: abdulmohsen Date: Fri, 17 Jun 2022 17:57:19 +0300 Subject: [PATCH] Moved Console logger output to stderr instead stdout to not interfere with --- src/Libs/Extends/ConsoleHandler.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Libs/Extends/ConsoleHandler.php b/src/Libs/Extends/ConsoleHandler.php index c68ce9e4..ec58bd9a 100644 --- a/src/Libs/Extends/ConsoleHandler.php +++ b/src/Libs/Extends/ConsoleHandler.php @@ -6,6 +6,7 @@ use App\Libs\Config; use DateTimeInterface; use Monolog\Handler\AbstractProcessingHandler; use Monolog\Logger; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; class ConsoleHandler extends AbstractProcessingHandler @@ -70,7 +71,9 @@ class ConsoleHandler extends AbstractProcessingHandler $message .= ' { ' . arrayToString($record['context']) . ' }'; } - $this->output->writeln($message, $this->output->getVerbosity()); + $errOutput = $this->output instanceof ConsoleOutputInterface ? $this->output->getErrorOutput() : $this->output; + + $errOutput?->writeln($message, $this->output->getVerbosity()); } /**