Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logback sdk install does not work for async appenders #12979

Open
ataraxis opened this issue Dec 30, 2024 · 0 comments
Open

Logback sdk install does not work for async appenders #12979

ataraxis opened this issue Dec 30, 2024 · 0 comments
Labels
bug Something isn't working needs triage New issue that requires triage

Comments

@ataraxis
Copy link

Describe the bug

OpenTelemetryAppender.install iterates through all the loggers to find appenders where it should inject the sdk. When using an async appender though, OpenTelemetryAppender is referenced through the async appender rather than directly from a logger so the sdk does not get installed.

Steps to reproduce

    <appender name="otel-async" class="ch.qos.logback.classic.AsyncAppender">
        <appender-ref ref="otel-sync" />
    </appender>

    <appender name="otel-sync" class="io.opentelemetry.instrumentation.logback.appender.v1_0.OpenTelemetryAppender">
        <captureExperimentalAttributes>true</captureExperimentalAttributes>
        <captureMarkerAttribute>true</captureMarkerAttribute>
        <captureKeyValuePairAttributes>true</captureKeyValuePairAttributes>
    </appender>

    <root level="DEBUG">
        <appender-ref ref="otel-async"/>
    </root>

Expected behavior

Appender references would be traversed recursively and the sdk installed on appenders that are only referenced from other appenders.

Actual behavior

Only appenders referenced directly from a logger are iterated. The following can workaround the issue, but it's non-obvious.

    <logger name="dummy" level="OFF">
      <appender-ref ref="otel-sync" />
    </logger>

Javaagent or library instrumentation version

2.11

Environment

JDK: 17
OS: Ubuntu 23.10

Additional context

No response

@ataraxis ataraxis added bug Something isn't working needs triage New issue that requires triage labels Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage New issue that requires triage
Projects
None yet
Development

No branches or pull requests

1 participant