[
https://issues.apache.org/jira/browse/LOG4J2-2721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16975708#comment-16975708
]
Rémi C. edited comment on LOG4J2-2721 at 11/16/19 2:20 PM:
-----------------------------------------------------------
I think if a null value got in, it should be replace by a null String ("") or
"null" to leave a trace a null value was sent.
The point is that it is awful to validate all the logs value to ensure it is
not null. This complexity should be encapsulate in MapMessage.
Or at least there could be another "with" method which would allow the null
value or a setting.
was (Author: micromic):
I think if a null value got in, it should be replace by a null String ("") or
"null" to leave a trace a null value was sent.
The point is that it is awful to validate all the logs value to ensure it is
not null.
> Thread crash when parameter is a null value for StringMapMessage
> ----------------------------------------------------------------
>
> Key: LOG4J2-2721
> URL: https://issues.apache.org/jira/browse/LOG4J2-2721
> Project: Log4j 2
> Issue Type: Bug
> Components: API
> Affects Versions: 2.12.1
> Reporter: Rémi C.
> Priority: Major
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> {code:java}
> logger.info(myMarker, new StringMapMessage()
> .with("message", "Test message")
> .with("event.action", null)
> .with("event.category", "General"));{code}
> This will crash. It is not supposed to happen, but sometimes a parameter can
> be null unexpectedly.
>
> MapMessage should be "null safe".
>
> [https://github.com/apache/logging-log4j2/blob/master/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java]
> line 732
--
This message was sent by Atlassian Jira
(v8.3.4#803005)