Skip to content

Remove the log4j.map_message prefix from attributes from that logging instrumentation #13787

Open
@harsimar

Description

@harsimar

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

I was wondering if there is a specific reason why the log4j.map_message prefix is appended onto attributes produced by that instrumentation, and if it is possible to remove it, similar to how it has been done for MDC: #9536.

In the application insights java agent, we recently implemented a feature where a specific log attribute is parsed to send a different kind of telemetry to application insights. This feature does not currently work for logs produced by mapMessage() as the attribute name with the prefix appended on to it does not match a specific attribute name we are looking for.
cc: @trask

Describe the solution you'd like

Logs that are produced from the log4j mapMessage() method should not append a prefix on any custom attributes. Ideally the current prefix should be removed.

Describe alternatives you've considered

In application insights java agent code, we can add an extra condition to search for "log4j.map_message" + specialAttributeName. However, there may be slightly better performance if we didn't need to add an extra condition to begin with.

Additional context

No response

Activity

added
contribution welcomeRequest makes sense, maintainers probably won't have time, contribution would be welcome
and removed
needs triageNew issue that requires triage
on May 1, 2025
added this to the v3.0.0 milestone on May 1, 2025
trask

trask commented on May 1, 2025

@trask
Member

We'd welcome a contribution for this, we may hold on merging the PR until 3.0 to avoid user churn.

AlchemyDing

AlchemyDing commented on May 10, 2025

@AlchemyDing
Member

@trask I am willing to contribute to this, please assign this issue to me

linked a pull request that will close this issue on May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

contribution welcomeRequest makes sense, maintainers probably won't have time, contribution would be welcomeenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

    Participants

    @trask@harsimar@AlchemyDing

    Issue actions

      Remove the log4j.map_message prefix from attributes from that logging instrumentation · Issue #13787 · open-telemetry/opentelemetry-java-instrumentation