Skip to main content

Logging & Tracing

Logging

For convenience, DBOS provides a pre-configured logger for you to use available at DBOS.logger. For example:

DBOS.logger.info("Welcome to DBOS!");

You can configure the log level of this built-in logger. This also configures the log level of the DBOS library:

DBOS.setConfig({
name: 'my-app',
databaseUrl: process.env.DBOS_DATABASE_URL,
logLevel: "info",
});
await DBOS.launch();

Tracing

DBOS automatically constructs OpenTelemetry traces of all workflows and their steps.

DBOS constructs hierarchical spans for workflows and each of their steps. For example, if an HTTP endpoint calls a workflow that calls a transaction, DBOS constructs a trace encompassing the entire request, with spans for the HTTP endpoint, the workflow, and the transaction. The transaction span is a child of the workflow span, which is a child of the HTTP endpoint span. You can access your current span via DBOS.span.

OpenTelemetry Export

You can export DBOS traces to any OpenTelemetry Protocol (OTLP)-compliant receiver.

You can configure a custom export target. For example:

DBOS.setConfig({
name: 'my-app',
databaseUrl: process.env.DBOS_DATABASE_URL,
otlpTracesEndpoints: ["http://localhost:4318/v1/traces"],
});
await DBOS.launch();

For example, try using Jaeger to visualize the of your local application.