Skip to content
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

Replacement in logs (log formatting) doesn't work in OpenTelemetry Logging #44440

Closed
fhavel opened this issue Nov 12, 2024 · 2 comments · Fixed by #45640
Closed

Replacement in logs (log formatting) doesn't work in OpenTelemetry Logging #44440

fhavel opened this issue Nov 12, 2024 · 2 comments · Fixed by #45640
Assignees
Labels
Milestone

Comments

@fhavel
Copy link
Contributor

fhavel commented Nov 12, 2024

Describe the bug

Logs are not resolved when using MessageFormat variant of logs. Using String.format variant works as expected:

var replacement = "replaced!";
Log.infov("infov {0}", replacement); // results in OpenTelemetry log message "infov {0}"
Log.infof("infof %s", replacement); // results in OpenTelemetry log message "infov replaced!"

Expected behavior

Log.infov produces formatted messages in OpenTelemetry logs.

Actual behavior

Format string (template) is being sent to OpenTelemetry.

How to Reproduce?

Attached quick start example may be used as a reproducer.

  1. start the application in dev mode
  2. call the endpoint http://localhost:8080/hello
  3. check logs in Grafana dev service

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.16.2

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

Reproducer:
opentelemetry-quickstart.zip

@fhavel fhavel added the kind/bug Something isn't working label Nov 12, 2024
Copy link

quarkus-bot bot commented Nov 12, 2024

/cc @brunobat (opentelemetry), @radcortez (opentelemetry)

@brunobat
Copy link
Contributor

App log shows:

15:39:59 INFO  traceId=d56be2a58ec662c9cfa3028eefd093a2, parentId=, spanId=726ddb9a87c01b80, sampled=true [or.ac.op.TracedResource] (executor-thread-1) infov replaced!
15:39:59 INFO  traceId=d56be2a58ec662c9cfa3028eefd093a2, parentId=, spanId=726ddb9a87c01b80, sampled=true [or.ac.op.TracedResource] (executor-thread-1) infof replaced!

OTel Logging shows:

2024-11-12 15:39:59.346 infof replaced! 
2024-11-12 15:39:59.345 infov {0} 

Looks like there is a problem with LOG.infov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants