Changing MDC value type from numeric to alphanumeric stops working for gelf logging
hasanyildiz opened this issue · 1 comments
when logging using log4j MDC with something like MDC.put("duration","12 ms") , console appender works fine,file appender works fine but with gelf appender there is no log. If i disable the line // MDC.put("duration","12 ms") also graylog works fine but without duration info. There are also other MDC keys and all works as expected. Since other appenders work, i think may be the issue is related to logstash-gelf appender.
My gelf configuration is ;
<appender name="gelf" class="biz.paluch.logging.gelf.log4j.GelfLogAppender"> <param name="Threshold" value="INFO" /> <param name="Host" value="udp:some ip" /> <param name="Port" value="12201" /> <param name="ExtractStackTrace" value="true" /> <param name="FilterStackTrace" value="true" /> <param name="MdcProfiling" value="true" /> <param name="TimestampPattern" value="yyyy-MM-dd HH:mm:ss" /> <param name="MaximumMessageSize" value="8192" /> <param name="version" value="1.1"/> <param name="IncludeFullMdc" value="true" /> </appender>
using ;
log4j log4j 1.2.17biz.paluch.logging logstash-gelf 1.14.1
Edit:
Actually, the problem was not related to key "duration".
Here is the actual issue;
let's say i have a MDC key "duration" and it takes only numeric values (like int,long etc.) and then lately i want "duration" to be alphanumeric and the problem occurs. Console and file logs work fine but graylog is not logging because of this reason.
This isn't something logstash-gelf
can help. Migrating fields from alphanumeric to numeric only or vice-versa needs to happen outside of this library. You can use additionalFieldTypes
to configure field typing instead of using type auto-discovery.