You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug is related only to current library or I've tested the same behaviour with the built-in logger and this is not a bug of NestJS.
What is the current behavior?
Using nestjs pino logger in beforeApplicationShutdown and onApplicationShutdown callbacks doesn't log in the stdout. However in onModuleDestroy using logger, logs the event. console.log works in all three callbacks.
What is the expected behavior?
Nestjs pino logger should be available in all three shutdown callbacks.
Please provide minimal example repo, not code snippet. Without example repo this issue will be closed. https://github.com/dilshans2k/nestjs-pino-issue/tree/feature/pino-test-with-nestjspino4-pino8.18-pinohttp9
In this repo, i have app module, then a nested module inside app module and a provider 'GracefulShutdownEventLogger'. Now what i have seen is if i put a sleep in the provider 'GracefulShutdownEventLogger' in onApplicationShutdown cb (since this provider will be called the last upon application destroy), all other services application shutdown callbacks will be able to log using pino logger, but i don't know why this happens. And why do i need to wait in the 'GracefulShutdownEventLogger'.
Please mention other relevant information such as Node.js version and Operating System.
Node@16.20.2 Ubuntu 22.04
The text was updated successfully, but these errors were encountered:
I learned that pino uses asynchronous logging, and their docs mention that some buffered logs might get lost on sudden system failure. I get that this can happen if the process receives a SIGKILL, but a SIGTERM or SIGINT is not a sudden failure, so pino should flush the logs properly on those signals. Maybe there is something wrong with my code. Can you please check it?
What is the current behavior?
Using nestjs pino logger in beforeApplicationShutdown and onApplicationShutdown callbacks doesn't log in the stdout. However in onModuleDestroy using logger, logs the event. console.log works in all three callbacks.
What is the expected behavior?
Nestjs pino logger should be available in all three shutdown callbacks.
Please provide minimal example repo, not code snippet. Without example repo this issue will be closed.
https://github.com/dilshans2k/nestjs-pino-issue/tree/feature/pino-test-with-nestjspino4-pino8.18-pinohttp9
In this repo, i have app module, then a nested module inside app module and a provider 'GracefulShutdownEventLogger'. Now what i have seen is if i put a sleep in the provider 'GracefulShutdownEventLogger' in onApplicationShutdown cb (since this provider will be called the last upon application destroy), all other services application shutdown callbacks will be able to log using pino logger, but i don't know why this happens. And why do i need to wait in the 'GracefulShutdownEventLogger'.
Please mention other relevant information such as Node.js version and Operating System.
Node@16.20.2 Ubuntu 22.04
The text was updated successfully, but these errors were encountered: