Это необходимо. возникает из-за необходимости отслеживать поток в серии журналов. В настоящее время вызов клиента, который использует другой поток, теряется среди всех остальных журналов.
это мой клиент и конфигурация
Код: Выделить всё
@FeignClient(
name = "client",
url = "${client.url}",
fallbackFactory = ClientFallbackFactory.class,
configuration = FeignConfig.class
)
public interface Client {
@GetMapping(value = "${client.path}")
Optional getObjs(
@RequestParam("id") Integer id,
@RequestParam("boolParm") Boolean boolParm,
@RequestParam("appendix") Integer appendix
) throws FallbackErrorException;
}
Код: Выделить всё
@Configuration
@EnableFeignClients(
basePackages = {
"client.package"
}
)
public class FeignConfig {
@Bean
public CustomFeignRequestLogging customFeignRequestLogging()
{
return new CustomFeignRequestLogging();
}
@Bean
Logger.Level feignLoggerLevel() {
return Logger.Level.BASIC;
}
}
Код: Выделить всё
[
{"timestamp": "2024-07-02T10:00:00", "level": "INFO", "thread": "MainThread", "mdc": {"userID": "12345", "flowID": "abcde"}, "message": "Starting process for user 12345"},
{"timestamp": "2024-07-02T10:00:01", "level": "INFO", "thread": "MainThread", "mdc": {"userID": "12345", "flowID": "abcde"}, "message": "Processing data for user 12345"},
{"timestamp": "2024-07-02T10:00:02", "level": "INFO", "thread": "MainThread", "mdc": {"userID": "12345", "flowID": "abcde"}, "message": "Preparing to call external service for user 12345"},
**{"timestamp": "2024-07-02T10:00:03", "level": "INFO", "thread": "FeignThread", "message": "Calling external service"}**,
{"timestamp": "2024-07-02T10:00:04", "level": "INFO", "thread": "FeignThread", "mdc": {}, "message": "Received response from external service"},
{"timestamp": "2024-07-02T10:00:05", "level": "INFO", "thread": "MainThread", "mdc": {"userID": "12345", "flowID": "abcde"}, "message": "Completed processing for user 12345"},
{"timestamp": "2024-07-02T10:00:06", "level": "INFO", "thread": "MainThread", "mdc": {"userID": "67890", "flowID": "fghij"}, "message": "Starting process for user 67890"},
{"timestamp": "2024-07-02T10:00:07", "level": "INFO", "thread": "MainThread", "mdc": {"userID": "67890", "flowID": "fghij"}, "message": "Processing data for user 67890"},
{"timestamp": "2024-07-02T10:00:08", "level": "INFO", "thread": "MainThread", "mdc": {"userID": "67890", "flowID": "fghij"}, "message": "Preparing to call external service for user 67890"}
]
спасибо за помощь
Подробнее здесь: https://stackoverflow.com/questions/786 ... ign-thread