Skip to content

Commit

Permalink
doc: add note for handling signal events in trace events
Browse files Browse the repository at this point in the history
Refs: #14802

PR-URL: #41438
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Adrian Estrada <edsadr@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
  • Loading branch information
thedull authored and danielleadams committed Feb 27, 2022
1 parent 87dcd93 commit fa61e6f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/api/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ string that supports `${rotation}` and `${pid}`:
node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
```

To guarantee that the log file is properly generated after signal events like
`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers
in your code, such as:

```js
process.on('SIGINT', function onSigint() {
console.info('Received SIGINT.');
process.exit(130); // Or applicable exit code depending on OS and signal
});
```

The tracing system uses the same time source
as the one used by `process.hrtime()`.
However the trace-event timestamps are expressed in microseconds,
Expand Down

0 comments on commit fa61e6f

Please sign in to comment.