Skip to content

Utilize ExceptionAttributeResolver in log4j/logback appenders #14485

@philsttr

Description

@philsttr

Is your feature request related to a problem? Please describe.

Currently the log4j/logback appenders explicitly configure the exception.* attributes (see here and here)

Applications may want to customize how these attributes are recorded. For example, to shorten stacktraces, or record additional attributes for certain exceptions.

Describe the solution you'd like

open-telemetry/opentelemetry-java#7266 introduced a new experimental ExceptionAttributeResolver concept to allow customization of how the exception.* attributes are resolved.

I would like the log4j and logback appenders to utilize this new ExceptionAttributeResolver to store exception.* attributes, rather than explicitly specifying those attributes.

To do so, the log4j/logback log event mappers could utilize the ExtendedLogRecordBuilder.setException(..) method (which delegates to the ExceptionAttributeResolver) here and here, instead of setting the exception.* attributes directly.

Describe alternatives you've considered

No response

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds triageNew issue that requires triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions