Skip to content

Unable to set Log Level using using OTEL_LOG_LEVEL #390

@raphael-gi

Description

@raphael-gi

When trying to set the Log Level to something like WARN or ERROR this should be possible via the environment variable OTEL_LOG_LEVEL.

Looking at the current implementation this is currently being done like this:

diag.setLogger(cds.log('telemetry'), process.env.OTEL_LOG_LEVEL || getDiagLogLevel())

The issue is that the library used (opentelemetry) checks if this value is of type number.

if (typeof optionsOrLogLevel === 'number') {
    optionsOrLogLevel = {
        logLevel: optionsOrLogLevel,
    };
}

Which it can't be since it is being read straight from process.env which has everything as strings.

Should this issue be fixed in opentelemetry or in this library?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions