Graylog2 / gelfclient

GELF client library for Java based on Netty 4
https://www.graylog.org/
Apache License 2.0
38 stars 19 forks source link

Support arrays and booleans within JSON? #29

Closed tul closed 7 years ago

tul commented 7 years ago

Is it intentional that arrays and booleans are not supported by this lib? Eg passing additional fields such as:

// lBuild is a GelfMessageBuilder
String[] myStringArray = {"a","b","c"};
Boolean myBool = true;
lBuilder.addAdditionalField("extra",myStringArray);
lBuilder.addAdditionalField("extra2",myBool);

Results in the array, for example, being casted to a string and thus coming through as "[Ljava.lang.String;@52f9da27'" etc

The encoder appears to handle numbers, null and string - could it perhaps handle array and boolean too?

joschi commented 7 years ago

@mctully Arrays/lists are intentionally not supported because they're not part of the GELF specification.

Booleans should be supported, though. What's the issue you see with boolean values?

joschi commented 7 years ago

@mctully Thanks for reporting this bug!

I've fixed the case with booleans in #30.

tul commented 7 years ago

Ok, thanks for your reply and the boolean fix. I'll move away from arrays then. Thanks!