《Flowable文档大全》
Added in 6.5.0, Logging sessions allow you to collect information about process execution even if an exception causes the transaction to be rolled back. This is enabled by providing a LoggingListener implementation to the engine configuration. The loggingListener contains a single method called loggingGenerated that takes a list of Jackson ObjectNodes.
In this simple implementation, each ObjectNode is sent to the logger:
添加到6.5.0中的日志会话允许您收集有关流程执行的信息,即使异常导致事务回滚。这是通过向引擎配置提供LoggingListener实现来开启的。loggingListener包含一个名为loggingGenerated 的方法,它接受Jackson对象节点(Jackson ObjectNode)的列表。
在这个简单的实现中,每个ObjectNode都被发送到记录器:
class MyLoggingListener implements LoggingListener{
static Logger logger = LoggerFactory.getLogger(MyLoggingListener.class);
@Override
public void loggingGenerated(List<ObjectNode> loggingNodes) {
loggingNodes.forEach(jsonNodes -> logger.info(jsonNodes.toString()));
}
}
During process engine configuration, an instance of the LoggingListener is passed
在流程引擎配置期间,将传递LoggingListener的实例
ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
.setJdbcUrl("jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000")
.setLoggingListener(new MyLoggingListener())
.buildProcessEngine();
The list of ObjectNodes passed to loggingGenerated method Are JSON objects, with at least the following attributes:
Additional fields will also be present based on the type of event they describe:
传递给loggingGenerated方法的objectNode列表是JSON对象,至少具有以下属性:
根据所描述的事件类型,还将显示其他字段:
2020-01-21 10:46:54.852 INFO 4985 --- [ restartedMain] c.e.f.MyLoggingListener : {
"message":"Variable 'initiator' created","scopeId":"a193efb3-3c6d-11ea-a01d-bed6c476b3ed","scopeType":"bpmn","variableName":"initiator","variableType":"null","variableRawValue":null,"variableValue":null,"scopeDefinitionId":"loggingSessionProcess:1:a18d38ef-3c6d-11ea-a01d-bed6c476b3ed","scopeDefinitionKey":"loggingSessionProcess","scopeDefinitionName":"Logging Session Process","__id":"a1948bf5-3c6d-11ea-a01d-bed6c476b3ed","__timeStamp":"2020-01-21T16:46:54.819Z","type":"variableCreate","__transactionId":"a1948bf5-3c6d-11ea-a01d-bed6c476b3ed","__logNumber":1}