diff --git a/src/Consumer.php b/src/Consumer.php index e792aab..5810bff 100644 --- a/src/Consumer.php +++ b/src/Consumer.php @@ -199,32 +199,37 @@ public function process(MessageInterface $message, QueueInterface $queue) : void $queue->reject($message); if ($this->logger instanceof LoggerInterface) { - $this->logger->debug(sprintf( + $this->logger->error(sprintf( 'The queue message <%d> cannot be acknowledged (reject executed). %s', $message->getId(), $e->getMessage() - )); + ), [ + 'payload' => $message->getPayload(), + ]); } } catch (UndecodablePayloadExceptionInterface $e) { $queue->reject($message); if ($this->logger instanceof LoggerInterface) { - $this->logger->debug(sprintf( + $this->logger->error(sprintf( 'The queue message <%d> contains undecodable payload (reject executed). %s', $message->getId(), $e->getMessage() - )); + ), [ + 'payload' => $message->getPayload(), + ]); } } catch (InvalidPayloadExceptionInterface $e) { $queue->reject($message); if ($this->logger instanceof LoggerInterface) { - $this->logger->debug(sprintf( + $this->logger->warning(sprintf( 'The queue message <%d> contains invalid payload (reject executed). %s', $message->getId(), $e->getMessage() ), [ 'errors' => $e->getErrors(), + 'payload' => $message->getPayload(), ]); } } catch (Throwable $e) { @@ -237,6 +242,7 @@ public function process(MessageInterface $message, QueueInterface $queue) : void $e->getMessage() ), [ 'exception' => $e, + 'payload' => $message->getPayload(), ]); } }