Seldaek / monolog

Sends your logs to files, sockets, inboxes, databases and various web services
https://seldaek.github.io/monolog/
MIT License
21.05k stars 1.9k forks source link

Encounter problem in format function #1880

Closed falahatiali closed 7 months ago

falahatiali commented 7 months ago

Monolog version 3. we are using 3.7 version. the format function signature changed from array $records to LogRecord $record.

I changed all array $record to LogRecord object but when I try to clear the cache in Symfony I get this exception:

TypeError {#9879
  #message: "Monolog\Logger::handleException(): Argument #2 ($record) must be of type Monolog\LogRecord, array given, called in myproject/vendor/monolog/monolog/src/Monolog/Logger.php on line 393"
  #code: 0
  #file: "./vendor/monolog/monolog/src/Monolog/Logger.php"
  #line: 710
  trace: {
    ./vendor/monolog/monolog/src/Monolog/Logger.php:710 { …}
    ./vendor/monolog/monolog/src/Monolog/Logger.php:393 { …}
    ./vendor/monolog/monolog/src/Monolog/Logger.php:657 { …}
    ./vendor/symfony/console/EventListener/ErrorListener.php:48 { …}
    ./vendor/symfony/event-dispatcher/Debug/WrappedListener.php:116 { …}
    ./vendor/symfony/event-dispatcher/EventDispatcher.php:220 { …}
    ./vendor/symfony/event-dispatcher/EventDispatcher.php:56 { …}
    ./vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:139 { …}
    ./vendor/symfony/console/Application.php:1064 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:96 { …}
    ./vendor/symfony/console/Application.php:301 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:82 { …}
    ./vendor/symfony/console/Application.php:171 { …}
    ./bin/console:47 {
      › $application = new Application($kernel);
      › $application->run($input, $output);
      › 
      arguments: {
        $input: Symfony\Component\Console\Input\ArgvInput {#2 …}
        $output: Symfony\Component\Console\Output\ConsoleOutput {#25 …}
      }
    }
  }
}
stof commented 7 months ago

make sure all your processors are returning a LogRecord

falahatiali commented 7 months ago

make sure all your processors are returning a LogRecord

what do you mean from processors?

falahatiali commented 7 months ago

I get this new exception.

User Deprecated: Since symfony/monolog-bridge 6.4: The "Symfony\Bridge\Monolog\Logger" class is deprecated, use HttpKernel's DebugLoggerConfigurator instead