Skip to content

fix(LoggingEvent): serde for NaN, Infinity, -Infinity, undefined#1332

Merged
lamweili merged 3 commits intomasterfrom
fix/serde
Oct 1, 2022
Merged

fix(LoggingEvent): serde for NaN, Infinity, -Infinity, undefined#1332
lamweili merged 3 commits intomasterfrom
fix/serde

Conversation

@lamweili
Copy link
Copy Markdown
Contributor

@lamweili lamweili commented Oct 1, 2022

Fixes #1187

Supersedes PR #1188

Affected Components

Only affects clustering, multiprocessAppender, and tcpAppender.
These three will serialise() to String to transmit for the receiver to deserialise().

Code Object
(Input)
Serialised
(Transmission)
Deserialised
(Output)
Match
{"a": Number("abc")} {"a": NaN} {"a": "__LOG4JS_NaN__"} {"a": NaN} ✔️
{"b": 1/0} {"b": Infinity} {"b": "__LOG4JS_Infinity__"} {"b": Infinity} ✔️
{"c": -1/0} {"c": -Infinity} {"c": "__LOG4JS_-Infinity__"} {"c": -Infinity} ✔️
[undefined] [undefined] ["__LOG4JS_undefined__"] [undefined] ✔️

Compared to PR #1188, now the output matches exactly the input.

@lamweili lamweili added the bug Something isn't working label Oct 1, 2022
@lamweili lamweili added this to the 6.7.0 milestone Oct 1, 2022
@lamweili lamweili merged commit 570ef53 into master Oct 1, 2022
@lamweili lamweili deleted the fix/serde branch October 1, 2022 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NaN needs to be handled here, otherwise JSON.stringfly will convert NaN to null below

1 participant