Comments (10)
Can you reproduce without pino-syslog? I think the bug is there and not in pino proper.
More specifically, pino-syslog does not implement the close()
callback (https://github.com/pinojs/pino-abstract-transport?tab=readme-ov-file#buildfn-opts--stream) to tear down the destination stream properly. As a result, whatever is "in flight" there will be lost.
from pino.
I tried adding a close
callback function, but it did not prevent or "delay" the thread(Worker)'s exit.
In other words, the thread had already closed before I could do anything
https://github.com/pinojs/thread-stream/blob/main/lib/worker.js#L147-L153
from pino.
You linked the logic that catches unhandledRejections.. how is that related?
from pino.
You linked the logic that catches unhandledRejections.. how is that related?
Sorry, the link above is incorrect, and in the above text, I mistakenly wrote the main process
as a thread
from pino.
Please add reproductions.
from pino.
thank you for your prompt reply
Lines 60 to 67 in c109804
My confusion stems from the fact that once Node.js
enters the exit
event, even if we add a ref
to the worker stream
, the main process will not wait for any active resources and will terminate immediately after the autoEnd
function completes. Is there a mechanism within Pino
itself that can prompt the main process to wait?
from pino.
The transport functionality I’m aiming to implement is as follows:
- To collect logs passed down from upstream and, depending on their
level
, write them to different files (similar to howpm2
does it). - Then, to synchronize these logs with a
syslog server
, which is why I needpino-syslog
.
like : #318
from pino.
My confusion stems from the fact that once Node.js enters the exit event, even if we add a ref to the worker stream, the main process will not wait for any active resources and will terminate immediately after the autoEnd function completes. Is there a mechanism within Pino itself that can prompt the main process to wait?
Yes, pino has its logic there to handle that case, while pino-syslog doesn't use it.
from pino.
Yes, pino has its logic there to handle that case, while pino-syslog doesn't use it.
I’m seeking guidance. How can I ‘delay’ the exit process?
from pino.
My confusion stems from the fact that once Node.js enters the exit event, even if we add a ref to the worker stream, the main process will not wait for any active resources and will terminate immediately after the autoEnd function completes. Is there a mechanism within Pino itself that can prompt the main process to wait?
Yes, pino has its logic there to handle that case, while pino-syslog doesn't use it.
Add autoEnd : false ?
Line 38 in c109804
from pino.
Related Issues (20)
- Simple log file rotation HOT 2
- Request: mixed sync/async transports HOT 5
- transport for file does not work in middleware. HOT 2
- Re-add support for standard console-style parameter logging HOT 6
- transport options - either confusing variable names or I'm just still learning (free to admit it) HOT 1
- create a function to capture full log object HOT 1
- consider using toad-cache HOT 2
- Filtering of the content using transformations in the pipeline for multiple transports HOT 1
- [question] How do I create dynamic customized logfile names? HOT 3
- Inclusive language suggestion: rename default branch to "main" across Pino's repos HOT 3
- Bundling to `ESM` using `vite` HOT 1
- ESLint: Unsafe call of an `any` typed value.(@typescript-eslint/no-unsafe-call) HOT 2
- Applying regex to redact keys or value HOT 3
- Accessing log level label from transport HOT 7
- Verifying logs from unit tests (again!) HOT 6
- Docs: Pino Logging with Grafana Promtail/Loki HOT 3
- [Question] Same logger for both node and browser HOT 3
- Using pino with nextjs HOT 2
- Transport is not being waited for in lambda HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pino.