I am facing this error "Uncaught TypeError: Argument 1 passed to IlluminateLogLogger
::__construct() must be an instance of PsrLogLoggerInterface, instance of Mono
logLogger given,"
when i run php artisan command. my php version is 7.3.9
You could try going to illuminate/log/Logger.php and adding use MonologLogger as Monolog; at the beginning of the file. After that, change the constructor from this:
/**
* Create a new log writer instance.
*
* @param PsrLogLoggerInterface $logger
* @param IlluminateContractsEventsDispatcher|null $dispatcher
* @return void
*/
public function __construct(LoggerInterface $logger, Dispatcher $dispatcher = null)
{
$this->logger = $logger;
$this->dispatcher = $dispatcher;
}
to this:
/**
* Create a new log writer instance.
*
* @param MonologLogger $logger
* @param IlluminateContractsEventsDispatcher|null $dispatcher
* @return void
*/
public function __construct(Monolog $logger, Dispatcher $dispatcher = null)
{
$this->logger = $logger;
$this->dispatcher = $dispatcher;
}
2
Answers
You could try going to
illuminate/log/Logger.php
and addinguse MonologLogger as Monolog;
at the beginning of the file. After that, change the constructor from this:to this:
I had this issue last night, tried with php 7.3 and 7.4 in the end i just used the latest php 8.1 and this issue went away.