Flowable 6.6.0 BPMN用户指南 - 17 高级用例 - 17.13 日志记录会话[实验性]

《Flowable 6.6.0 BPMN用户指南》

1. 入门
2. 配置
3 The Flowable API
4 Flowable 6.6.0 BPMN用户指南 - (4)Spring集成
5 Spring Boot
6 部署
7 BPMN 2.0简介
8 BPMN 2.0的构造
9 表单(Forms)
10 流程实例迁移
11 JPA
12 历史(History)
13 身份管理(Identity management)
14 REST API
15 CDI集成
16 LDAP集成
17 高级用例
  • 17.1 异步执行器(Async Executor)
    • 17.1.1 异步执行器设计(Async Executor design)
    • 17.1.2 异步执行器配置
    • 17.1.3 基于异步执行器的消息队列
  • 17.2 与流程解析挂钩(Hooking into process parsing)
  • 17.3 用于高并发的UUID ID生成器
  • 17.4 多租户(Multitenancy)
  • 17.5 执行自定义SQL(Execute custom SQL)
  • 17.6 采用ProcessEngineConfigurator 进行高级的流程引擎配置
  • 17.7 高级查询API:运行时和历史任务查询之间的无缝切换
  • 17.8 重写标准SessionFactory实现自定义身份管理
  • 17.9 启用安全的BPMN 2.0 xml
  • 17.10 事件日志记录(Event logging)
  • 17.11 禁用批量插入(Disabling bulk inserts)
  • 17.12 安全脚本(Secure Scripting)
  • 17.13 日志记录会话[实验性]

有关Flowable的更多文档,参见:

《Flowable文档大全》


17.13 日志记录会话[实验性]

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();

17.13.1 LoggingSession ObjectNodes

The list of ObjectNodes passed to loggingGenerated method Are JSON objects, with at least the following attributes:

  • message - a human readable message
  • scopeId - a correlation ID to group all messages from the same transaction
  • scopeType - the type of the scope

Additional fields will also be present based on the type of event they describe:

传递给loggingGenerated方法的objectNode列表是JSON对象,至少具有以下属性:

  • message -人类可读信息
  • scopeId-对来自同一事务的所有消息进行分组的相关ID
  • scopeType-作用域(scope)的类型

根据所描述的事件类型,还将显示其他字段:

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}

你可能感兴趣的:(Flowable,6.6.0,BPMN用户指南,-9-18)