编码习惯--日志
1、详细的日志打印可以帮助更好的排查问题
@ServiceActivator(inputChannel = "fileChannel")
public void processFile(Message<File> message) throws IOException {
securityUtil.logInAs("system");
File payload = message.getPayload();
logger.info(">>> Processing file: " + payload.getName());
String content = FileUtils.readFileToString(payload, "UTF-8");
SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yy HH:mm:ss");
logger.info("> Processing content: " + content + " at " + formatter.format(new Date()));
ProcessInstance processInstance = processRuntime.start(ProcessPayloadBuilder
.start()
.withProcessDefinitionKey("categorizeProcess")
.withProcessInstanceName("Processing Content: " + content)
.withVariable("content", content)
.build());
logger.info(">>> Created Process Instance: " + processInstance);
logger.info(">>> Deleting processed file: " + payload.getName());
payload.delete();
}
浙公网安备 33010602011771号