question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RabbitMQ: Logs still not right Nest 8

See original GitHub issue

Versions:

Something still isn’t quite right with the logs. When I do this:

const app = await NestFactory.create(AppModule, {
    logger: false,
  });

I still get logs from RabbitMQModule:

[Nest] 31  - 08/02/2022, 2:54:27 PM     LOG [AmqpConnection] Trying to connect to RabbitMQ broker (default)
[Nest] 31  - 08/02/2022, 2:54:27 PM     LOG [AmqpConnection] Successfully connected to RabbitMQ broker (default)
[Nest] 31  - 08/02/2022, 2:54:27 PM     LOG [RabbitMQModule] Successfully connected to RabbitMQ
[Nest] 31  - 08/02/2022, 2:54:27 PM     LOG [AmqpConnection] Successfully connected a RabbitMQ channel "AmqpConnection"
[Nest] 31  - 08/02/2022, 2:54:27 PM     LOG [RabbitMQModule] Initializing RabbitMQ Handlers
[Nest] 31  - 08/02/2022, 2:54:27 PM     LOG [RabbitMQModule] Registering rabbitmq handlers from AddressListenerService
[Nest] 31  - 08/02/2022, 2:54:27 PM     LOG [RabbitMQModule] AddressListenerService.onInteractionRecorded {subscribe} -> pubsub::interaction.recorded::service-suspect:address-listener:on-interaction-recorded

and nothing further.

I am suspecting its to do with the new logger instances created here but I haven’t had the chance currently to put into real testing.

  1. https://github.com/golevelup/nestjs/blob/master/packages/rabbitmq/src/rabbitmq.module.ts#L91

because the official recommended ways to replace the logger just dont work with the latest changes:

  1. https://github.com/iamolegga/nestjs-pino#example
  2. https://docs.nestjs.com/techniques/logger#dependency-injection

Do you think that it can just be changed to how all the other modules do it?

  1. https://github.com/nestjs/graphql/blob/master/packages/graphql/lib/graphql.module.ts#L54
  2. https://github.com/nestjs/bull/blob/3b94b9dc6f9dcde444dbed6c04f41f28d7b9e025/packages/bullmq/lib/bull.explorer.ts#L32
  3. https://github.com/nestjs/sequelize/blob/5b4c350db87a4fb7b519ada41b7eb604366ca0d9/lib/common/sequelize.utils.ts#L10
  4. https://github.com/nestjs/cqrs/blob/d6c176bed923fe38c18d2a05c35c72a3dca6e663/src/event-bus.ts#L36
  5. https://github.com/nestjs/azure-database/blob/e368290afd64ff0768e13ddfaad9813c16a7905d/lib/table-storage/azure-table.service.ts#L3

I don’t use all of those, but none of them require defining a custom logger in their arguments for it to work correctly with overriding your own logger.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alko89commented, Aug 2, 2022

I guess one solution would be to have both nest 8 and 9 as peer dependencies. The only real breaking change in v9 were unit tests, so it should (theoretically) work with both.

I wouldn’t backport these features to later versions though and I don’t think versioning works like that in this project. But I’m not a maintainer and it works for me 😃

0reactions
zogotcommented, Aug 2, 2022

Issue is in 2.4.1 and up. Could we get version 2 to stay with Nest 8 and version 3 to go with Nest 9?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to View & Aggregate RabbitMQ Logs: 101 Logging Guide
Read about RabbitMQ log file format, location, log levels, and more. Basic tips on how to enable RabbitMQ logging and analyze logs for ......
Read more >
rabbitmqctl(8) — RabbitMQ
Instructs the RabbitMQ node to perform internal log rotation. Log rotation is performed according to the logging settings specified in the configuration file....
Read more >
Clustering Guide - RabbitMQ
Clustering Guide. Overview. This guide covers fundamental topics related to RabbitMQ clustering: How RabbitMQ nodes are identified: node names ...
Read more >
Logging - RabbitMQ
Log Rotation. RabbitMQ nodes always append to the log files, so a complete log history is preserved. Log file rotation is not performed...
Read more >
Command Line Tools - RabbitMQ
UTF-8). If that's not the case, the tools may still function correctly but it ... CLI tools can be used to talk to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found