kamilkrzywanski opened a new pull request, #4180:
URL: https://github.com/apache/logging-log4j2/pull/4180
## What
Fixes #4141: `StructuredDataMessage` XML encoding omitted the free-form
message supplied at construction.
## Changes
- Encode the constructor `message` field as a distinct `<message>` element
in `asXml`, with the same XML escaping used for `type` and `id`
- Keep it separate from map entries so a user-supplied `put("message", ...)`
remains an independent SD-PARAM
- Omit the element when the constructor message is `null`
- Add regression tests for inclusion, escaping, and the map-key conflict case
### Example
```java
new StructuredDataMessage("an id", "a message", "a type");
```
now encodes as:
```xml
<StructuredData>
<type>a type</type>
<id>an id</id>
<message>a message</message>
<Map>
</Map>
</StructuredData>
```
When both the constructor message and a map entry keyed `"message"` are set,
both appear:
```xml
<message>a message</message>
...
<Entry key="message">foo</Entry>
```
## Testing
```bash
mvn -pl log4j-api-test -am test -Dtest=StructuredDataMessageTest
-Dsurefire.failIfNoSpecifiedTests=false
```
All `StructuredDataMessageTest` cases pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]