[
https://issues.apache.org/jira/browse/QPID-8771?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18124241#comment-18124241
]
ASF GitHub Bot commented on QPID-8771:
--------------------------------------
usugumo opened a new pull request, #454:
URL: https://github.com/apache/qpid-broker-j/pull/454
**JIRA Issue**
[QPID-8771](https://issues.apache.org/jira/browse/QPID-8771): [Broker-J]
Socket logger modifies producer MDC and loses caller information
**PR Description**
Each socket logger now creates its own immutable MDC snapshot, preserving
the original event and thread context. The calling class, method, and line on
the originating thread are captured before queuing the event, when
`includeCallerData` is enabled.
> [Broker-J] Socket logger modifies producer MDC and loses caller information
> ---------------------------------------------------------------------------
>
> Key: QPID-8771
> URL: https://issues.apache.org/jira/browse/QPID-8771
> Project: Qpid
> Issue Type: Bug
> Components: Broker-J
> Affects Versions: qpid-java-broker-10.1.0, qpid-java-broker-10.1.1
> Reporter: Takahashi Kiyoshi
> Priority: Minor
>
> While testing BrokerLogbackSocket logging with a local Logback receiver and
> another appender, we found that configured MDC additions affect the
> producer’s logging context, and the transmitted metadata depends on appender
> order. Caller information is also missing despite includeCallerData being
> enabled.
> The reproduction uses Java 17 and Logback 1.6.3 with:
> - Producer-thread MDC: \{"requestId":"request-123","origin":"producer"}
> - Socket logger mappedDiagnosticContext:
> \{"origin":"socket","broker":"node-a"}
> - Socket logger includeCallerData: true
> - A second appender that reads the event’s MDC, representing local logging
> alongside remote logging
> Reproduction steps: emit a logging event, inspect the producer MDC after the
> logging call, and compare the local and received events. Repeat with the
> second appender running before and after the socket appender.
> The following problems occur:
> 1. Producer MDC is modified: the existing "origin" entry is removed after the
> logging call instead of retaining "producer".
> 2. Socket metadata leaks into other appenders: when the socket appender runs
> first, the local event also contains "origin=socket" and "broker=node-a".
> 3. Configured socket metadata can be omitted: when another appender has
> already captured the event’s MDC, the remote event retains "origin=producer"
> and lacks "broker=node-a".
> 4. Caller information is missing: the received event has an empty caller-data
> array despite "includeCallerData=true".
> The expected behavior is that only the socket event receives the configured
> MDC additions. Its MDC should contain "requestId=request-123",
> "origin=socket", and "broker=node-a". The producer thread and other appenders
> should retain the original MDC. Requested caller information should identify
> the original logging location
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]