Closed tuyula closed 1 year ago
Hey @tuyula ,
Can you explain more about your use case? What kind of attributes do you want included in the log statements? %L
means line number in log4j AFAIR, I don't understand how it's related to OpenTelemetry.
we use java-agent export logging=otlp to collector
our company logs pattern like: 10:29:44 [http-nio-8080-exec-3] INFO com.observable.trace.otel.controller.SpanController:27 [traceId=54ce397c1b94affeae68e063e62608a7 spanId=afa2ea8e73f5c135] hello world
however, otlp logs like collector_1 | InstrumentationScope com.observable.trace.otel.controller.SpanController collector_1 | LogRecord #0 collector_1 | ObservedTimestamp: 1970-01-01 00:00:00 +0000 UTC collector_1 | Timestamp: 2022-07-06 02:29:44.492 +0000 UTC collector_1 | Severity: INFO collector_1 | Body: enter index / collector_1 | Trace ID: 54ce397c1b94affeae68e063e62608a7 collector_1 | Span ID: afa2ea8e73f5c135 collector_1 | Flags: 1
but, we also want collector %L by java-agent, then we cant view line number in our logs system
just like zap "caller", i want log4j have the same propery
hi @tuyula! this is now possible using -Dotel.instrumentation.logback-appender.experimental.capture-code-attributes=true
, check out:
This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed automatically if there is no response from the author within 7 additional days from this comment.
Is your feature request related to a problem? Please describe. we want view logs by this%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] [%logger:%L] %msg%n
but i dont know how to get %L which mean code num in otlp model
Describe the solution you'd like map %L to otlp attributes so that i can view in es