RuleGo RuleGo
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • AI Agent Framework
  • GFlow Approval Workflow (opens new window)
  • TPCLAW Agent Platform (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文
🏠Home
  • Quick Start
  • Rule Chain
  • Standard Components
  • Extension Components
  • Custom Components
  • Visualization
  • RuleGo-Server
  • AOP
  • Trigger
  • Advanced Topics
  • Performance
  • Standard Components
  • Extension Components
  • Custom Components
  • Components Marketplace
  • Overview
  • Quick Start
  • Routing
  • DSL
  • API
  • Options
  • Components
🔥Editor (opens new window)
  • RuleGo Editor (opens new window)
  • RuleGo Server (opens new window)
  • StreamSQL
  • AI Agent Framework
  • GFlow Approval Workflow (opens new window)
  • TPCLAW Agent Platform (opens new window)
  • Github (opens new window)
  • Gitee (opens new window)
  • Changelog (opens new window)
  • English
  • 简体中文

广告采用随机轮播方式显示 ❤️成为赞助商
  • Quick Start

  • Rule Chain

  • Standard Components

  • Extension Components

  • Custom Components

  • Components marketplace

  • Visualization

  • AOP

    • AOP Overview
    • Before Advice
    • After Advice
    • Around Advice
    • Start Advice
    • End Advice
    • Completed Advice
    • OnChainBeforeInit Advice
    • OnNodeBeforeInit 增强点
    • OnCreated Advice
    • OnReload Advice
    • OnDestroy Advice
    • builtin aspect

      • Debug Aspect
      • Fallback Aspect
      • Metrics Aspect
      • Concurrency Limiter Aspect
      • RuleChain Validator Aspect
      • Business Log Aspect
        • Event structure
        • Chain end trigger points
        • Configuration
        • Handler chain
  • Trigger

  • Advanced Topic

  • Agent Framework

  • RuleGo-Server

  • FAQ

  • Endpoint Module

  • Support

  • StreamSQL

目录

Business Log Aspect

Business Log Aspect: a built-in aspect, automatically imported. It asynchronously dispatches business log events produced by rule chain executions to an optional handler chain, or records them in run logs, without affecting the business flow.

Two event kinds:

  • Node log events (scope=node): a node configured with logConfig before/after templates emits an in event on entry and an out event on completion. Data is the rendered template result.
  • Chain end event (scope=chain): with chain configuration logEvents: ["chainEnd"], an end event is emitted each time the execution reaches a terminal branch. Data is the message data at the trigger point.

TIP

This aspect will be automatically imported and does not require manual introduction.

# Event structure

An event is a message with type=log; the handler chain receives it as-is:

Field Description
Data Node events: rendered template text. End events: message data at the trigger point (the end node's input is the author-designated output)
metadata.scope node / chain
metadata.phase in / out / end
metadata.nodeId, nodeName Node events only
metadata.relationType Output relation of out/end events: Success, Failure, True, False, etc.
metadata.error Error text on failure (end events carry a wrapped error with chain and node context)
metadata.chainId, msgId, ts Source chain, source message ID, nanosecond timestamp
metadata.renderError Set when template rendering fails; Data falls back to the raw template text

# Chain end trigger points

Follows the engine's end-node semantics, no deduplication:

  • Chain with an end node: only the end node triggers, exactly one event
  • Chain without end nodes: every leaf terminal triggers one event each

Failures trigger as well, with or without an end node: relationType=Failure with metadata.error set. Under the default config a failed branch triggers when it terminates, alongside the successful path's end-node event if both exist.

# Configuration

Node log templates: right-click a node and choose "Log", then configure before/after templates.

Node log dialog

Chain end reporting: right-click blank canvas and choose "Log Report Settings", pick a handler chain and check "Report on chain end".

Log report settings

Or write the DSL directly:

{
  "ruleChain": {
    "configuration": {
      "logHandler": "handler chain id",
      "logEvents": ["chainEnd"]
    }
  }
}
1
2
3
4
5
6
7
8
Field Type Description
logHandler string Handler chain id, optional; empty means run-log only
logEvents []string Only chainEnd is supported

WARNING

Values of ${global.x} are masked to *** before template rendering to avoid leaking host configuration.

# Handler chain

The handler chain is an ordinary rule chain. Filter nodes can branch on metadata.scope, metadata.relationType, etc. Dispatch runs independently: a missing handler chain or a dispatch panic only logs a warning, and the handler chain's own success or failure never affects the business chain. Event messages carry a loop guard, so nodes inside the handler chain may declare log templates without producing second-order events.

Edit this page on GitHub (opens new window)
Last Updated: 2026/10/09, 03:08:58
RuleChain Validator Aspect
Trigger

← RuleChain Validator Aspect Trigger→

Theme by Vdoing | Copyright © 2023-2026 RuleGo Team | Apache 2.0 License

  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式