[
https://issues.apache.org/jira/browse/LOG4J2-404?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kamal Bahadur updated LOG4J2-404:
---------------------------------
Comment: was deleted
(was: I updated the method private void appendStructuredElements(final
StringBuilder buffer, final LogEvent event) and it seem to fix the problem:
private void appendStructuredElements(final StringBuilder buffer, final
LogEvent event) {
final Message message = event.getMessage();
final boolean isStructured = message instanceof StructuredDataMessage;
if (!isStructured && (fieldFormatters!= null && fieldFormatters.size()
== 0) && !includeMDC) {
buffer.append("-");
return;
}
final Map<String, StructuredDataElement> sdElements = new
HashMap<String, StructuredDataElement>();
final Map<String, String> contextMap = event.getContextMap();
if (mdcRequired != null) {
checkRequired(contextMap);
}
if (fieldFormatters != null) {
for (final Map.Entry<String, FieldFormatter> sdElement:
fieldFormatters.entrySet()) {
final String sdId = sdElement.getKey();
final StructuredDataElement elem =
sdElement.getValue().format(event);
sdElements.put(sdId, elem);
}
}
if (includeMDC && contextMap.size() > 0) {
if (sdElements.containsKey(mdcSDID.toString())) {
final StructuredDataElement union =
sdElements.get(mdcSDID.toString());
union.union(contextMap);
sdElements.put(mdcSDID.toString(), union);
} else {
final StructuredDataElement formattedContextMap = new
StructuredDataElement(contextMap, false);
sdElements.put(mdcSDID.toString(), formattedContextMap);
}
}
if (isStructured) {
final StructuredDataMessage data = (StructuredDataMessage) message;
final Map<String, String> map = data.getData();
final StructuredDataId id = data.getId();
final String sdId = getId(id);
if (sdElements.containsKey(sdId)) {
final StructuredDataElement union =
sdElements.get(id.toString());
union.union(map);
sdElements.put(sdId, union);
} else {
final StructuredDataElement formattedData = new
StructuredDataElement(map, false);
sdElements.put(sdId, formattedData);
}
}
if (sdElements.size() == 0) {
buffer.append("-");
return;
}
for (final Map.Entry<String, StructuredDataElement> entry:
sdElements.entrySet()) {
formatStructuredElement(entry.getKey(), mdcPrefix,
entry.getValue(), buffer, checker);
}
})
> "@EnterpriseNumber" is missing in the ID of structured data when
> RFC5424Layout is used
> --------------------------------------------------------------------------------------
>
> Key: LOG4J2-404
> URL: https://issues.apache.org/jira/browse/LOG4J2-404
> Project: Log4j 2
> Issue Type: Bug
> Components: Layouts
> Affects Versions: 2.0-beta9
> Reporter: Kamal Bahadur
> Priority: Critical
> Attachments: RFC5424Layout.patch.txt
>
>
> Prior to beta9, when RFC5424 layout was used, the ID hasd the format
> "id@ein". With beta9, "@ein" is missing. Example
> Prior to beta9:
> <128>1 2013-09-16T02:07:24.027-07:00 myhost.com MyTestApp - Audit
> [stopPayment@12293 accountNumber="REPLACE" amount="***" checkNumber="***"
> comment="Changed mind" endSequence="4322" errorMessage="None"
> guId="669317b1-1eaf-11e3-80ec-005056b5071b"
> issueDate="20110504"][RequestContext@12293 ReqCtx_sessionId="66927b70***"
> ReqCtx_timezone="America/Los_Angeles" ReqCtx_tzOffset="-0800"
> ReqCtx_userProduct="IB" ReqCtx_userProductVersion="4.18.1"]
> With beta9:
> <128>1 2013-09-16T02:07:24.027-07:00 myhost.com MyTestApp - Audit
> [stopPayment accountNumber="REPLACE" amount="***" checkNumber="***"
> comment="Changed mind" endSequence="4322" errorMessage="None"
> guId="669317b1-1eaf-11e3-80ec-005056b5071b"
> issueDate="20110504"][RequestContext@12293 ReqCtx_sessionId="66927b70***"
> ReqCtx_timezone="America/Los_Angeles" ReqCtx_tzOffset="-0800"
> ReqCtx_userProduct="IB" ReqCtx_userProductVersion="4.18.1"]
> "@12293" is missing after the ID (stopPayment).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]