[
https://issues.apache.org/jira/browse/LOG4J2-2873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alla Gofman updated LOG4J2-2873:
--------------------------------
Description:
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() - does nothing and returns.
was:
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 es nothing and returns.
> 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() - does nothing and returns.
>
>
>
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)