Activities run in the standard NodeJS environment and can use any NodeJS logger.
Logging from Workflows is tricky for 2 reasons:
- Workflows run in an isolated JS environment and may not do any I/O
- Workflow code might get replayed generating duplicate log messages
In order to get around this limitation, use the External Dependencies mechanism to inject replay aware functions from the NodeJS environment into a Workflow isolate.
The Worker comes with a default logger which defaults to log any messages with level
INFO and higher to
The rationale behind this is to minimize Worker dependencies and allow SDK users to bring their own logger.
A common logging use case is logging to a file to be picked up by a collector like the Datadog Agent.