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

Provide OpenTelemetry instance to Log4j2 appender after initialization #10233

Closed
rickardoberg opened this issue Jan 14, 2024 · 1 comment · Fixed by #10243
Closed

Provide OpenTelemetry instance to Log4j2 appender after initialization #10233

rickardoberg opened this issue Jan 14, 2024 · 1 comment · Fixed by #10243
Assignees
Labels
bug Something isn't working

Comments

@rickardoberg
Copy link

Describe the bug

The Log4j2 appender seems to have conflicting implementation ideas. On the one hand there is the notion that Log4j2 can be initialized first, and so there is an eventsToReplay queue to deal with this. On the other hand the builder sets the OpenTelemetry instance to the noop version if none is specified, which then effectively throws away the log messages before the real OT instance has been installed, and the eventsToReplay queue never comes into play.

In my case Log4j2 is configured first, and then the OT instance, and so the idea with eventsToReplay would work great, except it's bypassed by the setting of a noop instance, and so I just lose all the log events before the OT instance is installed.

Steps to reproduce

Initialize Log4j2 first, then OT and call install.

Expected behavior

The appender should queue events before install is called (with either noop or SDK instance) and then replay them on install.

Actual behavior

Any events before install will be lost

Javaagent or library instrumentation version

1.32.0-alpha

Environment

JDK:
JDK 17
OS:
Win11

Additional context

No response

@rickardoberg rickardoberg added bug Something isn't working needs triage New issue that requires triage labels Jan 14, 2024
@laurit
Copy link
Contributor

laurit commented Jan 15, 2024

@jeanbisutti could you take a look

@jeanbisutti jeanbisutti self-assigned this Jan 15, 2024
@jeanbisutti jeanbisutti removed the needs triage New issue that requires triage label Jan 15, 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants