Skip to content

MDC attributes not captured with spring boot application using log4j. #12540

@nityanandagohain

Description

@nityanandagohain

I am using log4j in my spring boot application. The issue that I am facing is that the MDC attributes are not captured even after adding otel.instrumentation.log4j-appender.experimental.capture-mdc-attributes=* . Do I need to configure anything else ?

The other settings like otel.instrumentation.log4j-appender.experimental-log-attributes work as as expected.


update: I am able to get mdc attributes if I add them

ThreadContext.put("userId", "myid");
ThreadContext.put("requestId", "reqID");

But how do I capture attributes like className / LoggerName ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions