open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.98k stars 865 forks source link

Log4j2 appender does not report logger name #10322

Closed rickardoberg closed 10 months ago

rickardoberg commented 10 months ago

Describe the bug

I can't get the log4j2 appender to report logger name to my backend (New Relic). I can see in the code that it records the logger name as scope, and I can trace that scope does get serialized in the protobuf, but on the NR side there is no attribute for the scope, under any name. It's bizarre. It seems like somewhere it gets lost, and not sure if it's in the OT or NR side of things. Using JdkSender.

Steps to reproduce

Setup Log4j2 appender with JdkSender. Compression is on, if that makes a difference.

Expected behavior

The logger name should show up in the backend as some kind of attribute on the log message.

Actual behavior

No attributes on the log message in NR has the logger name.

Javaagent or library instrumentation version

v2.0.0-alpha of the log4j2appender

Environment

JDK: openjdk version "17.0.2" 2022-01-18 OS: Win 11

Additional context

No response

rickardoberg commented 10 months ago

nvrmind, I'm blind. It is reported as "otel.library.name". Is that how it's supposed to be? I was looking for "scope" or something like that.

jeanbisutti commented 10 months ago

@rickardoberg Are you using a non-OTLP format (Jaeger, Zipkin)?

laurit commented 10 months ago

Have a look at https://opentelemetry.io/docs/specs/otel/common/mapping-to-non-otlp/#instrumentationscope library was renamed to scope a while ago.

Is that how it's supposed to be?

You'd have to reach out to NR to get an answer for that.

rickardoberg commented 10 months ago

@jeanbisutti no, it's OLTP. I suspect it's a mapping happening in New Relic somehow. Now that I know what to look for it's ok, just a bit odd name for the logger name.