How do I create a keyvaluepair in log4j2 in a propterties file?
I know in log4j version 1 it's done like:
log4j.appender.x.additionalFields={'key': 'value'}
and the XML way for it in log4j2 is:
<KeyValuePair key="key" value="value"/>
so is way to do it for a properties file like this:
`appender.x.keyValuePair ={'key': 'value'}`
?
This is a working example of how to define a key value pair for example for the Graylog2 (GELF) appender:
appender.graylog.type=GELF
appender.graylog.name=GRAYLOG
appender.graylog.server=yourhostname
appender.graylog.includeStackTrace=true
appender.graylog.additional1.type=KeyValuePair
appender.graylog.additional1.key=yarncontainer
appender.graylog.additional1.value=containerXYZ
appender.graylog.additional2.type=KeyValuePair
appender.graylog.additional2.key=anotherKey
appender.graylog.additional2.value=anotherValue