Skip to content

OpenTelemetry Logging - exception attributes are missing when a parameterized log message is used #48321

@stephan-vollmer

Description

@stephan-vollmer

Describe the bug

When I use io.quarkus.logging.Log.errorf or org.jboss.logging.Logger.errorf to log an exception, the exception attributes like exception.message or exception.stacktrace are missing in the OTLP log record.

This happens when a log method is used that provides additional parameters:

  • org.jboss.logging.Logger.error("error", exception) - works
  • io.quarkus.logging.Log.error("error", exception) - works
  • org.jboss.logging.Logger.errorf("error: %s", msg, exception) - does not work
  • io.quarkus.logging.Log.errorf("error: %s", msg, exception) - does not work
  • org.jboss.logging.Logger.errorv("error: {0}", msg, exception) - does not work
  • io.quarkus.logging.Log.errorv("error: {0}", msg, exception) - does not work

Expected behavior

The exported OTLP log records should contain the attributes exception.message, exception.stacktrace and exception.type.

Example (OTel Collector debug log):

LogRecord #3
ObservedTimestamp: 2025-06-10 16:01:54.001829504 +0000 UTC
Timestamp: 2025-06-10 16:01:54.002049505 +0000 UTC
SeverityText: ERROR
SeverityNumber: Error(17)
Body: Str(JBoss Logging message 1)
Attributes:
     -> bridge.name: Str(com.example.app.TimetrackingScheduler)
     -> code.function: Str(transferTimetrackingData)
     -> code.lineno: Int(38)
     -> code.namespace: Str(com.example.app.TimetrackingScheduler)
     -> exception.message: Str(illegal argument)
     -> exception.stacktrace: Str(java.lang.IllegalArgumentException: illegal argument
        at com.example.app.TimetrackingScheduler.transferTimetrackingData(TimetrackingScheduler.java:38)
        at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73)
        at java.base/java.lang.Thread.run(Thread.java:1583)
)
     -> exception.type: Str(java.lang.IllegalArgumentException)
     -> log.logger.namespace: Str(org.jboss.logging.Logger)
     -> thread.id: Int(33)
     -> thread.name: Str(executor-thread-1)
Trace ID: 98f8deac564694a8ee7377ce990051c9
Span ID: aacc9dbec9c1cbdd
Flags: 1

Actual behavior

The exception attributes are missing.

Example:

LogRecord #4
ObservedTimestamp: 2025-06-10 16:01:54.002254477 +0000 UTC
Timestamp: 2025-06-10 16:01:54.002355975 +0000 UTC
SeverityText: ERROR
SeverityNumber: Error(17)
Body: Str(JBoss Logging message 2 illegal arg)
Attributes:
     -> bridge.name: Str(com.example.app.TimetrackingScheduler)
     -> code.function: Str(transferTimetrackingData)
     -> code.lineno: Int(39)
     -> code.namespace: Str(com.example.app.TimetrackingScheduler)
     -> log.logger.namespace: Str(org.jboss.logging.Logger)
     -> thread.id: Int(33)
     -> thread.name: Str(executor-thread-1)
Trace ID: 98f8deac564694a8ee7377ce990051c9
Span ID: aacc9dbec9c1cbdd
Flags: 1

How to Reproduce?

example-app.zip

Run the example app with quarkus dev. To trigger the startup event restart the app with s key.

Output of uname -a or ver

Linux hostname 5.15.0-141-generic #151-Ubuntu SMP Sun May 18 21:35:19 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "21.0.7" 2025-04-15 OpenJDK Runtime Environment (build 21.0.7+6-Ubuntu-0ubuntu122.04) OpenJDK 64-Bit Server VM (build 21.0.7+6-Ubuntu-0ubuntu122.04, mixed mode, sharing)

Quarkus version or git rev

3.20.1 LTS and 3.23.2

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

Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937) Maven home: C:\Users\user.m2\wrapper\dists\apache-maven-3.9.9-bin\33b4b2b4\apache-maven-3.9.9 Java version: 21.0.7, vendor: Red Hat, Inc., runtime: C:\java\jdk21 Default locale: de_DE, platform encoding: UTF-8 OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions