私の春のブートアプリケーションでは、私はlog4j2を使用しています。これは典型的なWebアプリケーションです。私は多くの接続があり、私は各接続のログを分離したいと思います。log4j2の設定スレッドコンテキスト
は私がThread Contextを使用したい:私は2つの端子にテストしてい
@RequestMapping(value = "/test", method = RequestMethod.GET)
public String test() throws InterruptedException
{
try (final CloseableThreadContext.Instance ctc = CloseableThreadContext.push(UUID.randomUUID().toString()))
{
logger.info("start");
Thread.sleep(1000);
logger.info("end.");
}
return "response";
}
:curl localhost:8000/test
。私は結果持っている。しかし:それはセッションのミックスだ
14:09:27.895 [qtp401792389-21] INFO Controllers.ContentController - start
14:09:28.062 [qtp401792389-19] INFO Controllers.ContentController - start
14:09:28.896 [qtp401792389-21] INFO Controllers.ContentController - end.
14:09:29.062 [qtp401792389-19] INFO Controllers.ContentController - end.
を、私はこの希望:だから
14:09:27.895 [qtp401792389-21] INFO Controllers.ContentController - start
14:09:28.896 [qtp401792389-21] INFO Controllers.ContentController - end.
14:09:28.062 [qtp401792389-19] INFO Controllers.ContentController - start
14:09:29.062 [qtp401792389-19] INFO Controllers.ContentController - end.
を、このために特別な設定はありますか?