-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
needs triageThis issue has not been looked intoThis issue has not been looked into
Description
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
When using pino as logger for application and enableShutdownHooks, Nest doesn't wait for it to write all logs before exiting.
If app.enableShutdownHooks() is not used and shutdown hooks added manually on process.once for SIGINT/SIGTERM/etc, then pino is able to finish its logging, but if we enable Nest.js shutdown hooks - there is something under the hood that has impact on pino finalization.
Would be nice to understand what is the conflict and how to avoid it to support both.
Minimum reproduction code
https://codesandbox.io/p/devbox/recursing-lamarr-qjh9hh
Steps to reproduce
- Clone/fork code
npm installnpm start- Wait app until app is up and running
- Press
Ctrl+Cor sendkill -2/kill -15to pid
Expected behavior
Nest shutdown process doesn't interrupt pino to write all necessary logs that are buffered.
NestJS version
11.1.9
Packages versions
{
"@nestjs/common": "^11.1.9",
"@nestjs/core": "^11.1.9",
"@nestjs/platform-express": "^11.1.9",
"pino": "^10.1.0",
"pino-pretty": "^13.1.2",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1"
}Node.js version
v20.12.1 (and others)
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response
micalevisk
Metadata
Metadata
Assignees
Labels
needs triageThis issue has not been looked intoThis issue has not been looked into