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 a way to transform data from the MDC context before passed on. #69

Closed agentgt closed 10 years ago

agentgt commented 10 years ago

I would like to add meta data fields that are numeric to Graylog2 by using the MDC context so that I can search on these fields as numbers and not strings.

Basically we have log statements that set the time that something took in the MDC context as well as other numeric metrics. The current implementation always converts MDC context fields into strings which is actually more or less the right thing to do since SLF4J only supports Strings in the MDC. However I would like to convert those numeric Strings back into numbers by extending the Appender to handle my special fields.

I tried to make as minimal change as I could while also providing a unit test.

t0xa commented 10 years ago

Thanks for your contribution.