skip to Main Content

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 enter image description here

2

Answers


  1. 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;
        }
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search