A source of truth for my thoughts about engineering and startups

How to enable open telemetry logs?


Frustratingly, @opentelemetry/auto-instrumentations-node does not log anything by default.

Their documentation also misleads you into thinking that you can enable logs by setting the OTEL_LOG_LEVEL environment variable to debug or trace.

I have not been successful with those approaches.

The only thing that worked was to manually configure the logger:

const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
// ...