-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logger Error function in Nestjs causing duplication #11074
Comments
does that happen in v9.2 as well? |
@micalevisk no.
|
the reproduction: I just reverted the changes made at #10531 (v9.3.0) and it start working as before again. |
Thank you for linking the PR @micalevisk. The reason this is happening is because when
Essentially returning
https://github.com/nestjs/nest/blob/master/packages/common/services/console-logger.service.ts#L275 Then, we check for the stack trace from the Then in our Looks like we need to account for the |
I'm working on a fix for this at the moment. Gonna update the tests too to make sure we've got it right |
Due to a change in nestjs#10531 when the `stack` is added as `undefined` a new `undefined` log would be added whenever `this.logger.error()` would be called. Now, we check that the last element is either a string or undefined, and if so strip the last element. That element should only exist when we artificially add the stack via the changes from nestjs#10531. closes nestjs#11074
Okay. Let's track this here: #11081 |
Is there an existing issue for this?
Current behavior
I am encountering an issue with the
logger.error
function. Whenever I use thelogger.error
function, it correctly logs the message, but immediately after that, there is another log which saysundefined
.The error is solved if I change
error
towarn
or something else.Minimum reproduction code
https://github.com/nestjs/nest
Steps to reproduce
No response
Expected behavior
I expect the
logger.error
function to correctly log the message without any subsequent log containing theundefined
message. The message should be unique and accurate, without duplication.Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
No response
NestJS version
9.3.2
Packages versions
Node.js version
No response
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: