🧁Custom request id
LiteFlow supports customizing your request Id.
When you execute a process, you can often see the following similar information in the log information:
2022-07-03 11:15:00.196 INFO 71275 --- [ main] com.yomahub.liteflow.flow.element.Node : [067a0baa6d434de3a8ccafa4b1506562]:[O]start component[a] execution
2022-07-03 11:15:00.204 INFO 71275 --- [ main] com.yomahub.liteflow.flow.element.Node : [067a0baa6d434de3a8ccafa4b1506562]:[O]start component[b] execution
2022-07-03 11:15:00.218 INFO 71275 --- [lf-when-thead-0] com.yomahub.liteflow.flow.element.Node : [067a0baa6d434de3a8ccafa4b1506562]:[O]start component[c] execution
2022-07-03 11:15:00.220 INFO 71275 --- [lf-when-thead-1] com.yomahub.liteflow.flow.element.Node : [067a0baa6d434de3a8ccafa4b1506562]:[O]start component[d] execution
2022-07-03 11:15:00.220 INFO 71275 --- [ main] com.yomahub.liteflow.slot.Slot : [067a0baa6d434de3a8ccafa4b1506562]:CHAIN_NAME[chain1]
a<1>==>b<0>==>c<0>==>d<0>
2022-07-03 11:15:00.221 INFO 71275 --- [ main] com.yomahub.liteflow.slot.DataBus : [067a0baa6d434de3a8ccafa4b1506562]:slot[0] released
The first part of the log body is the RequestId, and the requestId in a request is the same, which is convenient for you to search the log.
The form of this requestId can also be customized.
All you need to do is declare a class and implement the RequestIdGenerator
interface:
public class CustomRequestIdGenerator implements RequestIdGenerator {
@Override
public String generate() {
return System.nanoTime();
}
}
Then declare your class in the LiteFlow configuration file:
liteflow.request-id-generator-class=com.yomahub.liteflow.test.requestId.config.CustomRequestIdGenerator
tip
In general, LiteFlow has its own default Id generation rules. So in most cases you don't need to customize this Id generator specially.
Help us improve this document (opens new window)
last update: 2022/10/13, 00:02:27