t0xa / gelfj

Graylog Extended Log Format (GELF) implementation in Java and log4j appender without any dependencies.
https://github.com/t0xa/gelfj/wiki
Other
186 stars 116 forks source link

added GelfJsonAppender and docs for it #103

Closed the-james-burton closed 8 years ago

the-james-burton commented 8 years ago

Here is a PR for #102. It might be done better by merging the logic into the existing GelfAppender and offering a boolean to the user to turn JSON parsing on or off. I'll leave that decision to you.

I've updated the README.md too. I'm not sure why GitHub thinks the whole file is changed... I only added the "Automatically populating fields from a JSON message" section.

Hope this helps!

Regards, James

the-james-burton commented 8 years ago

After further testing, I noticed the addField method is String, String. Therefore to support other data types, this code is preferred...

        // gelfMessage.addField(key, fields.get(key));
        gelfMessage.getAdditonalFields().put(key, fields.get(key));