osiegmar/logback-gelf

StaticField add fail

teemo2009 opened this issue · 2 comments

add a staticField in logback.xml "order_id:{orderId}".

My interface

/**
* vin logger
*
* @param orderId
* @param content
* @Date 2019/9/12_14:06
*/
@PutMapping("/vin")
public void vin(@RequestParam("orderId") String orderId,
@RequestParam("content") String content) {
MDC.put("orderId", orderId);
log.info(content);
}

when orderId was number,It was ok,garylog console sout this message
but orderId like "2e22a1e1a68a4dde94c73ea56e04d914",no error,garylog was't this message.
I need your help!

You are mixing up two different things – if you want to pass additional log information with MDC you have to ensure that the configuration option includeMdcData is enabled. This has nothing to do with static fields, which would not be useful in your example.

You are mixing up two different things – if you want to pass additional log information with MDC you have to ensure that the configuration option includeMdcData is enabled. This has nothing to do with static fields, which would not be useful in your example.

lol!ok!