-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add support for OpenTelemetry Logging #2033
Comments
Are you suggesting a bridge to convert log4j log records to OpenTelemetry log records, or a bridge to convert OpenTelemetry log records into log4j log records? I think only the former should be pursued. The OpenTelemetry log bridge API is not meant to be called by application developer (i.e. its not meant to replace existing log APIs like log4j2, slf4j, JUL, etc). Instead, it exists for the purpose of writing log appenders, which bridge logs recorded in existing log APIs to OpenTelemetry, so that they can be processed / exported in a common way to any trace and metric telemetry. So while I don't think it makes sense to implement |
We're considering a fresh v3 logging API which the existing v2 API will be updated to extend (which has become fairly bloated over time). Given the similarity between While I haven't checked the dependency tree for the SDK or any collectors and such, I'm not sure to what extent you've already accomplished what we're trying to do here, but one of the main things is that we're at the bottom of the dependency stack, and as such, we accomplish a lot without bringing in third party dependencies. On the other hand, various observability libraries I've used in the past download half the internet and tend to break every other month or so (at least prior to OpenTelemetry; since Spring integrated Micrometer, I hope this is less fragile there, but it's a common issue). Similar to #2027, we'd like to do some of this directly rather than having other projects guess at the right place to instrument or extend Log4j since we can make whatever cross-cutting updates are needed to best support things. Perhaps you have some suggestions? |
Thank you for the explanation. Apparently I understood the OpenTelemetry Log Bridge API wrong. We should probably write a |
We should consider adding support for the OpenTelemetry Logging specification to Log4j API 3.x.
This would require:
log4j-otel
bridge that implementsLoggerProvider
,log4j-otel
. I am mostly concerned about theLogRecordBuilder#setContext
method, i.e. a way to programmatically inject context data into a logging event like we do withLogBuilder#withLocation
for the location data. We obviously don't expect users to add context data manually in their code, but some instrumentation can do it the same way we inject location with Log4j Transformer Maven plugin.What do you think?
The text was updated successfully, but these errors were encountered: