Area(s)
area:log
Is your change request related to a problem? Please describe.
Java log messages are often emitted as a template (with placeholders) + parameters, e.g.
log.info("Message {}, {} and {}", param1, param2, param3)
Using template + parameters is not really an indication from the user that this is a "structured log", as it is typically done as a performance optimization to avoid concatenating the string when the logging level is suppressed already (and also there are no parameter names).
Whereas there are other Java logging APIs which are intended for structured logging and using them is an indication from the user that this is a "structured log", e.g.
So in the OpenTelemetry Java logging appenders we think it makes sense in the first case to emit the "formatted" (interpolated) message in the log body (string), and in the second case to emit a "structured log body".
The first purpose of this issue is to see if others agree with our thinking.
The second purpose of this issue is to see how we could optionally capture the log template and parameters in the first case (e.g. to support open-telemetry/opentelemetry-java-instrumentation#11865).
Our initial proposal would be something like:
log.record.template
log.record.parameters
where log.record.parameters would be a string array, though another option could be log.record.parameters.<key> to more generally support named parameters (do other languages have these? and if there are named parameters is that a reason to capture as structured log?)
Thanks!
Describe the solution you'd like
not sure
Describe alternatives you've considered
No response
Additional context
No response
Area(s)
area:log
Is your change request related to a problem? Please describe.
Java log messages are often emitted as a template (with placeholders) + parameters, e.g.
Using template + parameters is not really an indication from the user that this is a "structured log", as it is typically done as a performance optimization to avoid concatenating the string when the logging level is suppressed already (and also there are no parameter names).
Whereas there are other Java logging APIs which are intended for structured logging and using them is an indication from the user that this is a "structured log", e.g.
So in the OpenTelemetry Java logging appenders we think it makes sense in the first case to emit the "formatted" (interpolated) message in the log body (string), and in the second case to emit a "structured log body".
The first purpose of this issue is to see if others agree with our thinking.
The second purpose of this issue is to see how we could optionally capture the log template and parameters in the first case (e.g. to support open-telemetry/opentelemetry-java-instrumentation#11865).
Our initial proposal would be something like:
log.record.templatelog.record.parameterswhere
log.record.parameterswould be a string array, though another option could belog.record.parameters.<key>to more generally support named parameters (do other languages have these? and if there are named parameters is that a reason to capture as structured log?)Thanks!
Describe the solution you'd like
not sure
Describe alternatives you've considered
No response
Additional context
No response