阅读背景:

在Spring中跨线程传递Log4j2 ThreadContext

来源:互联网 

Goal is to provide unique Id to all the log statements per request (which can spawn multiple threads due to AsynRestTemplate usage). I have a situation where "ListenableFutureCallback" onFailure() is retuning an exception. When the exception is thrown, Global Exception Handler is written extending "ResponseEntityExceptionHandler". I need to pass Log4j2 ThreadContext from onFailure to ResponseEntityExceptionHandler. someErrorHandler() method, so that log4j can log unique id for that request to correlate what happened to that call.Goal is to provide unique Id to all the log sta




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: