You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2020/06/19 17:53:00 UTC
[jira] [Commented] (LOG4J2-2873) Failed to parse json string to
LogEvent when massage type is MapMessage
[ https://issues.apache.org/jira/browse/LOG4J2-2873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17140730#comment-17140730 ]
Ralph Goers commented on LOG4J2-2873:
-------------------------------------
How is the server going to know that the event contains a MapMessage since it was serialized to a String?
> Failed to parse json string to LogEvent when massage type is MapMessage
> -----------------------------------------------------------------------
>
> Key: LOG4J2-2873
> URL: https://issues.apache.org/jira/browse/LOG4J2-2873
> Project: Log4j 2
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.13.2, 2.13.3
> Reporter: Alla Gofman
> Priority: Major
> Attachments: alert.json
>
>
> I create LogEvent where message is of type MapMessage (key-value pairs).
> I send this log event to SocketAppender by JsonLayout.
> The json created in attached file.
> I tried also setObjectMessageAsJsonObject(true) - same result.
> On ServerSocket side I want to parse/deserialize this json string to LogEvent and log it to File Appender:
> {quote}{{PatternLayout. JSONObject jobj = new JSONObject(line);}}
> {{LogEvent logEvent = new JsonLogEventParser().parseFrom(line);}}
> {quote}
>
> Then parseFrom() build the LogEvent, message object create of type SimpleMessage and not MapMessage. Then it comes to resolving *%map* pattern in MapPatternConverter.format() - do nothing and return.
>
>
>
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)