realityforge/gelf4j — pull request #4 by pmenon (2012-10-22 14:55:38+00:00)
Title: Allow client-provided JSON parsing class

Projects are growingly adopting JSON to represent configuration files, request and responses when operating over HTTP or even between internal components. When they choose to use GELF4J, they should not be forced to use SimpleJSON as a JSON parsing library.

This pull request allows clients to specify a JSON codec class in the GELF log appender configuration.

* Added a new "codecClass" configuration parameter
* If a codecClass is not specified in configuration or there is an error in instantiating the class, we fall back to the SimpleJson implementation
* Defer parsing additional/default fields until a codec is instantiated (either client-provided or default)
* Pass in the JsonCodec class to the GelfEncoder. This codec is then used to convert a GelfMessage to JSON before chunking into packets.
* Added tests to ensure proper configuration behaviour and fallback behaviour