Skip to content

Conversation

@laurit
Copy link
Contributor

@laurit laurit commented Sep 11, 2024

Resolves #12198
Instead of wrapping the logging event use reflection to update it. The current event wrapping solution uses LoggingEventVO.build because LoggingEventPreSerializationTransformer accepts only LoggingEventVO or LoggingEvent, but using LoggingEventVO looses access to caller data. Instead of the jdk proxy that we currently use we could use a custom proxy that extends LoggingEvent, but that is also problematic because our proxy would need to implement all methods that exist in any version of LoggingEvent (https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/logback/logback-appender-1.0/library/src/main/java/io/opentelemetry/instrumentation/logback/appender/v1_0/LoggingEventToReplay.java is similar in that regard) and it wouldn't be future proof (can't proactively handle methods that are added in future versions).
A limitation of proposed implementation is that it can only handle events of type LoggingEvent. This means that our appender needs to be arranged before other appenders that wrap the event.

@laurit laurit requested a review from a team September 11, 2024 09:51
@laurit laurit added this to the v2.8.0 milestone Sep 11, 2024
@trask trask merged commit 34740ee into open-telemetry:main Sep 12, 2024
56 checks passed
@laurit laurit deleted the logback-mdc branch September 13, 2024 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

logback-mdc will print ? instead of the actual class and method name

2 participants