Skip to main content

Logging

The Typescript SDK contains an internal logger with filtering based on a level.

The level is set by the RESTATE_LOGGING environment variable and the level values can be TRACE, DEBUG, INFO, WARN or ERROR.

The default log level is INFO if NODE_ENV=production is set, otherwise is DEBUG.

If you set the level to TRACE, you can also get more verbose logging of the journal by setting the environment variable RESTATE_JOURNAL_LOGGING=TRACE.

Console logging

If you use the default Node console logger, log statements will be printed over and over again during replays. To avoid this, you can use the Restate context logger, which is a wrapper around the console logger that suppresses duplicate log statements during replays:

ctx.console.info("This will not be printed again during replays");
ctx.console.debug("This will not be printed again during replays");
// Any other console logging method can be used

This logger uses the same level filtering as described above.